Importing required libraries

In [1]:
import pandas as pd
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
%matplotlib inline

Reading input file

In [2]:
covid = pd.read_csv("COVID-19 Cases.csv")
C:\Users\suraj\Anaconda3\lib\site-packages\IPython\core\interactiveshell.py:3063: DtypeWarning: Columns (8) have mixed types.Specify dtype option on import or set low_memory=False.
  interactivity=interactivity, compiler=compiler, result=result)

Analysis of existing data

In [3]:
print(covid.head(5),'\n')
print(covid.shape)
#(x,y)   x - lines    y - columns
   Case_Type  People_Total_Tested_Count  Cases  Difference       Date  \
0  Confirmed                        NaN      6           0  5/22/2020   
1  Confirmed                        NaN      0           0   2/3/2020   
2     Deaths                        NaN      0           0   3/1/2020   
3  Confirmed                        NaN     23           0  4/21/2020   
4     Deaths                        NaN     56           0  5/11/2020   

          Combined_Key       Country_Region Province_State Admin2 iso2 iso3  \
0       Western Sahara       Western Sahara            NaN    NaN   EH  ESH   
1          Switzerland          Switzerland            NaN    NaN   CH  CHE   
2               Cyprus               Cyprus            NaN    NaN   CY  CYP   
3  Antigua and Barbuda  Antigua and Barbuda            NaN    NaN   AG  ATG   
4             Thailand             Thailand            NaN    NaN   TH  THA   

   FIPS        Lat        Long  Population_Count  \
0   NaN  24.215500  -12.885800          597330.0   
1   NaN  46.818200    8.227500         8654618.0   
2   NaN  35.126400   33.429900         1207361.0   
3   NaN  17.060800  -61.796400           97928.0   
4   NaN  15.870032  100.992541        69799978.0   

   People_Hospitalized_Cumulative_Count  \
0                                   NaN   
1                                   NaN   
2                                   NaN   
3                                   NaN   
4                                   NaN   

                                         Data_Source     Prep_Flow_Runtime  
0  2019 Novel Coronavirus COVID-19 (2019-nCoV) Da...  6/4/2020 11:15:39 PM  
1  2019 Novel Coronavirus COVID-19 (2019-nCoV) Da...  6/4/2020 11:15:39 PM  
2  2019 Novel Coronavirus COVID-19 (2019-nCoV) Da...  6/4/2020 11:15:39 PM  
3  2019 Novel Coronavirus COVID-19 (2019-nCoV) Da...  6/4/2020 11:15:39 PM  
4  2019 Novel Coronavirus COVID-19 (2019-nCoV) Da...  6/4/2020 11:15:39 PM   

(950670, 18)
In [4]:
covid.info()
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 950670 entries, 0 to 950669
Data columns (total 18 columns):
 #   Column                                Non-Null Count   Dtype  
---  ------                                --------------   -----  
 0   Case_Type                             950670 non-null  object 
 1   People_Total_Tested_Count             6048 non-null    float64
 2   Cases                                 950670 non-null  int64  
 3   Difference                            950670 non-null  int64  
 4   Date                                  950670 non-null  object 
 5   Combined_Key                          950670 non-null  object 
 6   Country_Region                        950670 non-null  object 
 7   Province_State                        901260 non-null  object 
 8   Admin2                                878580 non-null  object 
 9   iso2                                  949590 non-null  object 
 10  iso3                                  949860 non-null  object 
 11  FIPS                                  849690 non-null  float64
 12  Lat                                   921780 non-null  float64
 13  Long                                  921780 non-null  float64
 14  Population_Count                      921780 non-null  float64
 15  People_Hospitalized_Cumulative_Count  6048 non-null    float64
 16  Data_Source                           950670 non-null  object 
 17  Prep_Flow_Runtime                     950670 non-null  object 
dtypes: float64(6), int64(2), object(10)
memory usage: 130.6+ MB
In [5]:
#Dataset contains numerical and categorical columns
#Checking the number of columns for each data type

numerical_feats = covid.dtypes[covid.dtypes != "object"].index
print("Number of Numerical features: ", len(numerical_feats))
print(numerical_feats)

categorical_feats = covid.dtypes[covid.dtypes == "object"].index
print("Number of Categorical features: ", len(categorical_feats))

print(covid[numerical_feats].columns)
print("*"*100)
print(covid[categorical_feats].columns)

print(covid[numerical_feats].columns)
print("*"*100)
print(covid[categorical_feats].columns)
Number of Numerical features:  8
Index(['People_Total_Tested_Count', 'Cases', 'Difference', 'FIPS', 'Lat',
       'Long', 'Population_Count', 'People_Hospitalized_Cumulative_Count'],
      dtype='object')
Number of Categorical features:  10
Index(['People_Total_Tested_Count', 'Cases', 'Difference', 'FIPS', 'Lat',
       'Long', 'Population_Count', 'People_Hospitalized_Cumulative_Count'],
      dtype='object')
****************************************************************************************************
Index(['Case_Type', 'Date', 'Combined_Key', 'Country_Region', 'Province_State',
       'Admin2', 'iso2', 'iso3', 'Data_Source', 'Prep_Flow_Runtime'],
      dtype='object')
Index(['People_Total_Tested_Count', 'Cases', 'Difference', 'FIPS', 'Lat',
       'Long', 'Population_Count', 'People_Hospitalized_Cumulative_Count'],
      dtype='object')
****************************************************************************************************
Index(['Case_Type', 'Date', 'Combined_Key', 'Country_Region', 'Province_State',
       'Admin2', 'iso2', 'iso3', 'Data_Source', 'Prep_Flow_Runtime'],
      dtype='object')
In [6]:
#So lets try to observe the missing data in every column of the dataset.
pd.options.display.max_rows = 4000
miss_tot = covid.isnull().sum().sort_values(ascending=False)
miss_percent = (covid.isnull().sum()/len(covid)).sort_values(ascending=False)
miss_data = pd.concat([miss_tot, miss_percent ], axis=1, keys=['miss_tot', 'miss_percent'])
miss_data
Out[6]:
miss_tot miss_percent
People_Hospitalized_Cumulative_Count 944622 0.993638
People_Total_Tested_Count 944622 0.993638
FIPS 100980 0.106220
Admin2 72090 0.075831
Province_State 49410 0.051974
Population_Count 28890 0.030389
Long 28890 0.030389
Lat 28890 0.030389
iso2 1080 0.001136
iso3 810 0.000852
Date 0 0.000000
Cases 0 0.000000
Difference 0 0.000000
Prep_Flow_Runtime 0 0.000000
Combined_Key 0 0.000000
Country_Region 0 0.000000
Data_Source 0 0.000000
Case_Type 0 0.000000
In [7]:
a=['Case_Type']

for i in a: 
    print(f"Count values of distinct {i}")
    print(covid[i].value_counts())
Count values of distinct Case_Type
Deaths       475335
Confirmed    475335
Name: Case_Type, dtype: int64
In [8]:
#Checking mising values percentage
print(((covid.isna().sum().sum())*100)/(950670*18))
12.85808955789075

Data imputation

In [9]:
#Imputing Population_Count column
#Filling missed Population_Count value by calculating "mean" of the colum( group by country_region)

covid['Population_Count'] = covid.groupby('Country_Region').Population_Count.transform(lambda x: x.fillna(x.mean()))
covid["Population_Count"] = covid["Population_Count"].fillna(3000)
  
In [10]:
#Finding out the records having Province_state or Admin2 as null but information for the lat is present
new_df = covid[((covid.Province_State.isnull()) | (covid.Admin2.isnull())) & (covid.Long.notnull())]
n_df = new_df[["Lat","Long"]]

#Total 71280 rows are returned in n_df
In [11]:
n_df.shape
#Dropping if there are any duplicate rows 
x= n_df.drop_duplicates()
x.shape
# Total 264 unique rows are present in dataset which do not have any Province_start/Admin2 but lat/long are present
Out[11]:
(264, 2)
In [12]:
#creating a tuple for 264 rows returned for lat/long
covid_tuple = tuple(zip(x['Lat'],x['Long']))
print(covid_tuple[0:10])
print(type(covid_tuple[1:10]))
len(covid_tuple)
((24.2155, -12.8858), (46.8182, 8.2275), (35.1264, 33.4299), (17.0608, -61.7964), (15.870032, 100.992541), (18.1096, -77.2975), (17.1899, -88.4976), (6.6111, 20.9394), (12.1165, -61.678999999999995), (39.0742, 21.8243))
<class 'tuple'>
Out[12]:
264
In [13]:
#Using reverse_geocoder to get details like city, county, state, countty code for corresponding lat and long and importing in a text file named geolocation_data.txt
import reverse_geocoder as rg 
import pprint 


of = open("geolocation_data.txt", "w")
def reverseGeocode(coordinates): 
    result = rg.search(coordinates) 
    #print(result)
    #print(type(result))
    x=str(result).replace("[OrderedDict([","").replace("])]","").replace("'lat',","").replace("'lon',","").replace("'name',","").replace("'admin1',","").replace("'admin2',","").replace("'cc',","").replace("(","").replace(")","").replace("'","").replace(" ","")
    longlat = str(coordinates).replace(")",",").replace("(","")
    #print(longlat,x)
    
    
    of.write("{}{} \n".format(longlat,x)) # writing to output file
   
  
# Driver function 
if __name__=="__main__": 
    # Coorinates tuple.Can contain more than one pair. 
    for i in range (264):
        coordinates = covid_tuple[i]
        reverseGeocode(coordinates)

of.close()
Loading formatted geocoded file...
In [14]:
#Converting geolocation_data.txt file into a dataframe "geo"

header_list = ["o_lat","o_long","lat","long","name","admin1","admin2","cc"]
geo = pd.read_csv("geolocation_data.txt", names = header_list)
geo.head(5)
Out[14]:
o_lat o_long lat long name admin1 admin2 cc
0 24.215500 -12.885800 25.14276 -12.37168 GueltatZemmour Laayoune-Boujdour-SakiaElHamra Boujdour MA
1 46.818200 8.227500 46.83333 8.18065 Giswil Obwalden Obwalden CH
2 35.126400 33.429900 35.10560 33.41977 Geri Lefkosia NaN CY
3 17.060800 -61.796400 17.06671 -61.79303 AllSaints SaintPeter NaN AG
4 15.870032 100.992541 15.83024 100.91938 BuengSamPhan Phetchabun AmphoeBuengSamPhan TH
In [15]:
geo.shape
Out[15]:
(264, 8)
In [16]:
#Joining the original COVID dataset with geo geolocation_data.txt dataset
join_df = covid.merge(geo, left_on = ["Lat","Long"], right_on = ["o_lat","o_long"], how="left")

#join_df is the combined dataframe now , below 8 columns are added into our original dataframe : 
#o_lat, o_long, lat , long, name, admin1, admin2, cc
In [17]:
join_df.head(5)
Out[17]:
Case_Type People_Total_Tested_Count Cases Difference Date Combined_Key Country_Region Province_State Admin2 iso2 ... Data_Source Prep_Flow_Runtime o_lat o_long lat long name admin1 admin2 cc
0 Confirmed NaN 6 0 5/22/2020 Western Sahara Western Sahara NaN NaN EH ... 2019 Novel Coronavirus COVID-19 (2019-nCoV) Da... 6/4/2020 11:15:39 PM 24.215500 -12.885800 25.14276 -12.37168 GueltatZemmour Laayoune-Boujdour-SakiaElHamra Boujdour MA
1 Confirmed NaN 0 0 2/3/2020 Switzerland Switzerland NaN NaN CH ... 2019 Novel Coronavirus COVID-19 (2019-nCoV) Da... 6/4/2020 11:15:39 PM 46.818200 8.227500 46.83333 8.18065 Giswil Obwalden Obwalden CH
2 Deaths NaN 0 0 3/1/2020 Cyprus Cyprus NaN NaN CY ... 2019 Novel Coronavirus COVID-19 (2019-nCoV) Da... 6/4/2020 11:15:39 PM 35.126400 33.429900 35.10560 33.41977 Geri Lefkosia NaN CY
3 Confirmed NaN 23 0 4/21/2020 Antigua and Barbuda Antigua and Barbuda NaN NaN AG ... 2019 Novel Coronavirus COVID-19 (2019-nCoV) Da... 6/4/2020 11:15:39 PM 17.060800 -61.796400 17.06671 -61.79303 AllSaints SaintPeter NaN AG
4 Deaths NaN 56 0 5/11/2020 Thailand Thailand NaN NaN TH ... 2019 Novel Coronavirus COVID-19 (2019-nCoV) Da... 6/4/2020 11:15:39 PM 15.870032 100.992541 15.83024 100.91938 BuengSamPhan Phetchabun AmphoeBuengSamPhan TH

5 rows × 26 columns

In [18]:
join_df.shape
Out[18]:
(950670, 26)
In [19]:
#Checking if the original data has corresponding values for county and state, if in case there was a long and lat with missing values in counties and states
#If any data existed then that can be used to impute the missing values
po = join_df[(join_df['o_lat'].notnull()) & (join_df['o_long'].notnull())  & (join_df['Admin2'].isnull())  ]
po = po[['o_lat','o_long']].drop_duplicates()
po.shape
Out[19]:
(230, 2)
In [20]:
# Imputing Province_State

#admin1(state) is the new column added in the dataframe ( From Geolocation text file )
#Imputing the Province_State column with admin1(State)
join_df['Province_State'] = np.where(join_df['Province_State'].isnull(), join_df['Province_State'].fillna(join_df['admin1']), join_df['Province_State'])
In [21]:
#Checking what percentage of data is still missing for Province_State column
#Since earlier imputation was done only for rows which have lat/long information available

pd.options.display.max_rows = 4000
miss_tot = join_df["Province_State"].isnull().sum()
miss_percent = miss_tot/ (join_df["Province_State"].count()) 
print(round(miss_percent*100,2),"% missing") 
0.83 % missing
In [22]:
join_df["Province_State"].count()
Out[22]:
942840
In [23]:
# Imputing remaining Province_State columns with Country_Region since many small coutries dont have states
join_df['Province_State'] = np.where(join_df['Province_State'].isnull(), join_df['Province_State'].fillna(join_df['Country_Region']), join_df['Province_State'])
In [24]:
#So lets try to observe the missing data for Province_State
pd.options.display.max_rows = 4000
miss_tot = join_df["Province_State"].isnull().sum()
miss_percent = miss_tot/ (join_df["Province_State"].count()) 
print(round(miss_percent*100,2),"% missing") 

#So imputing for Province_State is done
0.0 % missing
In [25]:
# Imputing (Admin2)County

#Checking what % of data is  missing data for Admin2(County)
join_df['Admin2'] = np.where(join_df['Admin2'].isnull(), join_df['Admin2'].fillna(join_df['admin2']), join_df['Admin2'])
join_df['Admin2'] = np.where(join_df['Admin2'].isnull(), join_df['Admin2'].fillna(join_df['Province_State']), join_df['Admin2'])

#So lets try to observe the missing data for Admin2(County)
pd.options.display.max_rows = 4000
miss_tot = join_df["Admin2"].isnull().sum()
miss_percent = miss_tot/ (join_df["Admin2"].count()) 
print(round(miss_percent*100,2),"% missing") 

#0.0% is missing now: Imputation is completed for Admin2
0.0 % missing
In [26]:
# Imputing iso2(Country Code)

join_df['iso2'] = np.where(join_df['iso2'].isnull(), join_df['iso2'].fillna(join_df['cc']), join_df['iso2'])

#So lets try to observe the missing data for iso2
pd.options.display.max_rows = 4000
miss_tot = join_df["iso2"].isnull().sum()
miss_percent = miss_tot/ (join_df["iso2"].count()) 
print(round(miss_percent*100,2),"% missing") 

#Still 0.09% is missing. Lets find out which are those
0.09 % missing
In [27]:
x=join_df[join_df["iso2"].isnull()]
print(x.shape)
x['Combined_Key'].value_counts()

##Missing values are from below three
#1 China (Hong Kong) 
#2 China (Macau)
#3 Crusie Ship
(810, 26)
Out[27]:
Hong Kong, China    270
Cruise Ship         270
Macau, China        270
Name: Combined_Key, dtype: int64
In [28]:
## Filled missed values like below (This is based on already existing iSO2 for the same combined_key
#1 China (Hong Kong)  -> HK
#2 China (Macau)-> MO
#3 Crusie Ship-> IW

join_df['iso2'] = np.where((join_df['iso2'].isnull()) & (join_df['Combined_Key'] == 'Macau, China') , join_df['iso2'].fillna("MO"), join_df['iso2'])
join_df['iso2'] = np.where((join_df['iso2'].isnull()) & (join_df['Combined_Key'] == 'Hong Kong, China') , join_df['iso2'].fillna("HK"),join_df['iso2'])
join_df['iso2'] = np.where((join_df['iso2'].isnull()) & (join_df['Combined_Key'] == 'Cruise Ship') , join_df['iso2'].fillna("IW"),join_df['iso2'])
In [29]:
#Checking what % of data is still missing for iso2
pd.options.display.max_rows = 4000
miss_tot = join_df["iso2"].isnull().sum()
miss_percent = miss_tot/ (join_df["iso2"].count()) 
print(round(miss_percent*100,2),"% missing") 

#0.0% is missing now: Imputation is completed for Admin2
0.0 % missing
In [30]:
# Imputation for Latitude and Longitude

#Checking what % of data is missing data for lat/long
pd.options.display.max_rows = 4000
miss_tot = join_df["Lat"].isnull().sum()
miss_percent = miss_tot/ (join_df["Lat"].count()) 
print(round(miss_percent*100,2),"% missing") 

#3.13% is missing
3.13 % missing
In [31]:
# Creating a datframe for null lat/long rows
io = join_df[(join_df['Lat'].isnull()) | (join_df['Long'].isnull()) ]
io.shape
Out[31]:
(28890, 26)
In [32]:
io.Country_Region.value_counts()
Out[32]:
US             28080
China            540
Cruise Ship      270
Name: Country_Region, dtype: int64
In [33]:
c = io[io.Country_Region=="China"]
c.iso2.value_counts()
Out[33]:
MO    270
HK    270
Name: iso2, dtype: int64
In [34]:
#Part1
#Imputing Null lat/long for China  
join_df['Lat'] = np.where((join_df['Lat'].isnull()) & (join_df['iso2'] == "HK") , join_df['Lat'].fillna("22.302711"),join_df['Lat'])
join_df['Long'] = np.where((join_df['Long'].isnull()) & (join_df['iso2'] == "HK") , join_df['Long'].fillna("114.177216"),join_df['Long'])
join_df['Lat'] = np.where((join_df['Lat'].isnull()) & (join_df['iso2'] == "MO") , join_df['Lat'].fillna("22.1210928"),join_df['Lat'])
join_df['Long'] = np.where((join_df['Long'].isnull()) & (join_df['iso2'] == "MO") , join_df['Long'].fillna("113.552971"),join_df['Long'])
In [35]:
#Checking what % of data is missing data for lat/long
pd.options.display.max_rows = 4000
miss_tot = join_df["Lat"].isnull().sum()
miss_percent = miss_tot/ (join_df["Lat"].count()) 
print(round(miss_percent*100,2),"% missing") 

#Still 3.07% is missing
3.07 % missing
In [36]:
#Part2
#Imputing Null lat/long for US
qq = join_df[(join_df['Lat'].isnull())  & (join_df['Country_Region'] == "US" )  ]
In [37]:
qq.Province_State.value_counts()
Out[37]:
Michigan                1080
South Carolina           540
Maryland                 540
Tennessee                540
Washington               540
Minnesota                540
Mississippi              540
South Dakota             540
Kansas                   540
Oklahoma                 540
Pennsylvania             540
Nebraska                 540
Utah                     540
District of Columbia     540
Louisiana                540
Ohio                     540
Missouri                 540
Hawaii                   540
Vermont                  540
Massachusetts            540
Texas                    540
Rhode Island             540
North Carolina           540
Oregon                   540
Arkansas                 540
Florida                  540
Iowa                     540
New Hampshire            540
Illinois                 540
Maine                    540
New Jersey               540
Delaware                 540
Indiana                  540
Wisconsin                540
Georgia                  540
Kentucky                 540
California               540
Idaho                    540
North Dakota             540
Virginia                 540
Alabama                  540
Nevada                   540
Connecticut              540
Arizona                  540
Colorado                 540
Wyoming                  540
West Virginia            540
Montana                  540
New Mexico               540
New York                 540
Alaska                   540
Name: Province_State, dtype: int64

So lets try to observe the missing data in every column of the dataset.

pd.options.display.max_rows = 4000 miss_tot = join_df.isnull().sum().sort_values(ascending=False) miss_percent = (join_df.isnull().sum()/len(join_df)).sort_values(ascending=False) miss_data = pd.concat([miss_tot, miss_percent ], axis=1, keys=['miss_tot', 'miss_percent']) miss_data

In [38]:
#Using US.csv file fill missing lat/long for US
df_US = pd.read_csv("US.csv")
print(df_US.head())
print(df_US.shape)
  state   latitude   longitude        name
0    AK  63.588753 -154.493062      Alaska
1    AL  32.318231  -86.902298     Alabama
2    AR  35.201050  -91.831833    Arkansas
3    AZ  34.048928 -111.093731     Arizona
4    CA  36.778261 -119.417932  California
(52, 4)
In [39]:
jo_df = join_df.merge(df_US, left_on = "Province_State", right_on = "name", how="left")
jo_df.shape
Out[39]:
(950670, 30)
In [40]:
#Part2 #Imputing Null lat/long for US and Cruise Ship. For US we are imputing using US dataset and for Cruise Ship we are imputing 0,0 for Lat,Long respectively.
jo_df['Lat'] = np.where(jo_df['Lat'].isnull() , jo_df['Lat'].fillna(jo_df['latitude']),jo_df['Lat'])
jo_df['Long'] = np.where(jo_df['Long'].isnull() , jo_df['Long'].fillna(jo_df["longitude"]),jo_df['Long'])
jo_df['Lat'] = np.where(jo_df['Lat'].isnull() , jo_df['Lat'].fillna(0.0),jo_df['Lat'])
jo_df['Long'] = np.where(jo_df['Long'].isnull() , jo_df['Long'].fillna(0.0),jo_df['Long'])
In [41]:
#Checking what % of data is missing data for lat/long
pd.options.display.max_rows = 4000
miss_tot = jo_df["Lat"].isnull().sum()
miss_percent = miss_tot/ (jo_df["Lat"].count()) 
print(round(miss_percent*100,2),"% missing") 

#0.0% is missing now: Imputation is completed for lat/long
0.0 % missing
In [42]:
#Checking the missing % columnwise
pd.options.display.max_rows = 4000
miss_tot = jo_df.isnull().sum().sort_values(ascending=False)
miss_percent = (jo_df.isnull().sum()/len(jo_df)).sort_values(ascending=False)
miss_data = pd.concat([miss_tot, miss_percent ], axis=1, keys=['miss_tot', 'miss_percent'])
miss_data
Out[42]:
miss_tot miss_percent
People_Total_Tested_Count 944622 0.993638
People_Hospitalized_Cumulative_Count 944622 0.993638
admin2 936900 0.985515
admin1 892080 0.938370
o_lat 888570 0.934678
cc 888570 0.934678
name_x 888570 0.934678
long 888570 0.934678
lat 888570 0.934678
o_long 888570 0.934678
FIPS 100980 0.106220
longitude 71820 0.075547
name_y 71820 0.075547
state 71820 0.075547
latitude 71820 0.075547
iso3 810 0.000852
Cases 0 0.000000
Province_State 0 0.000000
Difference 0 0.000000
Date 0 0.000000
Combined_Key 0 0.000000
Country_Region 0 0.000000
Population_Count 0 0.000000
Admin2 0 0.000000
iso2 0 0.000000
Lat 0 0.000000
Long 0 0.000000
Data_Source 0 0.000000
Prep_Flow_Runtime 0 0.000000
Case_Type 0 0.000000
In [43]:
#Dropped column "People_Total_Tested_Count" as 99% of the data is missing, data could not be imputated based on 1% data
#Dropped column "People_Hospitalized_Cumulative_Count" as 99% of the data is missing, data could not be imputated based on 1% data
#Dropped column FIPS , as it is just used in US for federal information. Will not use this column for data analysis

jo_df.drop(['People_Total_Tested_Count','People_Hospitalized_Cumulative_Count','FIPS','lat','long','o_lat','o_long','admin1','admin2','cc','Combined_Key','Data_Source','Prep_Flow_Runtime','iso3','name_x','latitude','longitude','iso3','name_x','name_y','state'],axis = 1, inplace = True)

jo_df.drop(['latitude','longitude'],axis = 1, inplace = True)

jo_df.drop(['iso3','name_x','name_y','state'],axis = 1, inplace = True)

In [44]:
#dropped/renamed columns
jo_df.rename(columns = {'Admin2':'County_City','iso2':'Country_Code','Long':'Longitude','Lat':'Latitude'}, inplace = True) 
In [45]:
jo_df.info()
<class 'pandas.core.frame.DataFrame'>
Int64Index: 950670 entries, 0 to 950669
Data columns (total 11 columns):
 #   Column            Non-Null Count   Dtype  
---  ------            --------------   -----  
 0   Case_Type         950670 non-null  object 
 1   Cases             950670 non-null  int64  
 2   Difference        950670 non-null  int64  
 3   Date              950670 non-null  object 
 4   Country_Region    950670 non-null  object 
 5   Province_State    950670 non-null  object 
 6   County_City       950670 non-null  object 
 7   Country_Code      950670 non-null  object 
 8   Latitude          950670 non-null  object 
 9   Longitude         950670 non-null  object 
 10  Population_Count  950670 non-null  float64
dtypes: float64(1), int64(2), object(8)
memory usage: 87.0+ MB
In [46]:
##Checking the missing % columnwise
pd.options.display.max_rows = 4000
miss_tot = jo_df.isnull().sum().sort_values(ascending=False)
miss_percent = (jo_df.isnull().sum()/len(jo_df)).sort_values(ascending=False)
miss_data = pd.concat([miss_tot, miss_percent ], axis=1, keys=['miss_tot', 'miss_percent'])
miss_data
#NO data is missing , data Imputation is done
Out[46]:
miss_tot miss_percent
Population_Count 0 0.0
Longitude 0 0.0
Latitude 0 0.0
Country_Code 0 0.0
County_City 0 0.0
Province_State 0 0.0
Country_Region 0 0.0
Date 0 0.0
Difference 0 0.0
Cases 0 0.0
Case_Type 0 0.0
In [47]:
jo_df.head()
Out[47]:
Case_Type Cases Difference Date Country_Region Province_State County_City Country_Code Latitude Longitude Population_Count
0 Confirmed 6 0 5/22/2020 Western Sahara Laayoune-Boujdour-SakiaElHamra Boujdour EH 24.2155 -12.8858 597330.0
1 Confirmed 0 0 2/3/2020 Switzerland Obwalden Obwalden CH 46.8182 8.2275 8654618.0
2 Deaths 0 0 3/1/2020 Cyprus Lefkosia Lefkosia CY 35.1264 33.4299 1207361.0
3 Confirmed 23 0 4/21/2020 Antigua and Barbuda SaintPeter SaintPeter AG 17.0608 -61.7964 97928.0
4 Deaths 56 0 5/11/2020 Thailand Phetchabun AmphoeBuengSamPhan TH 15.87 100.993 69799978.0

Data_Visualization

In [48]:
%matplotlib inline
import matplotlib.pyplot as plt
plt.style.use('seaborn-whitegrid')
import numpy as np
import matplotlib.ticker as ticker
import seaborn as sns; sns.set()
In [49]:
df_us = jo_df[jo_df['Country_Region'] == 'US']
In [50]:
final = jo_df
In [51]:
pip install plotly
Requirement already satisfied: plotly in c:\users\suraj\anaconda3\lib\site-packages (4.9.0)
Requirement already satisfied: retrying>=1.3.3 in c:\users\suraj\anaconda3\lib\site-packages (from plotly) (1.3.3)
Requirement already satisfied: six in c:\users\suraj\anaconda3\lib\site-packages (from plotly) (1.14.0)
Note: you may need to restart the kernel to use updated packages.
In [52]:
dummy = pd.get_dummies(final['Case_Type'])
dummy.head()
Out[52]:
Confirmed Deaths
0 1 0
1 1 0
2 0 1
3 1 0
4 0 1
In [53]:
#Concatanating Dummy columns (Column for confirmed and Death) to our dataframe for better analysis and data representation
#final2 is the concataned dataframe

final2 = pd.concat((final,dummy),axis=1)
In [54]:
final2.head()
Out[54]:
Case_Type Cases Difference Date Country_Region Province_State County_City Country_Code Latitude Longitude Population_Count Confirmed Deaths
0 Confirmed 6 0 5/22/2020 Western Sahara Laayoune-Boujdour-SakiaElHamra Boujdour EH 24.2155 -12.8858 597330.0 1 0
1 Confirmed 0 0 2/3/2020 Switzerland Obwalden Obwalden CH 46.8182 8.2275 8654618.0 1 0
2 Deaths 0 0 3/1/2020 Cyprus Lefkosia Lefkosia CY 35.1264 33.4299 1207361.0 0 1
3 Confirmed 23 0 4/21/2020 Antigua and Barbuda SaintPeter SaintPeter AG 17.0608 -61.7964 97928.0 1 0
4 Deaths 56 0 5/11/2020 Thailand Phetchabun AmphoeBuengSamPhan TH 15.87 100.993 69799978.0 0 1
In [55]:
#Populating the actual number of confirmed cases and deaths in dummy columns

final2['Confirmed'] = np.where((final2.Confirmed == 1),(final2.Cases),0)
final2['Deaths'] = np.where((final2.Deaths == 1),(final2.Cases),0)
In [56]:
final2.head()
Out[56]:
Case_Type Cases Difference Date Country_Region Province_State County_City Country_Code Latitude Longitude Population_Count Confirmed Deaths
0 Confirmed 6 0 5/22/2020 Western Sahara Laayoune-Boujdour-SakiaElHamra Boujdour EH 24.2155 -12.8858 597330.0 6 0
1 Confirmed 0 0 2/3/2020 Switzerland Obwalden Obwalden CH 46.8182 8.2275 8654618.0 0 0
2 Deaths 0 0 3/1/2020 Cyprus Lefkosia Lefkosia CY 35.1264 33.4299 1207361.0 0 0
3 Confirmed 23 0 4/21/2020 Antigua and Barbuda SaintPeter SaintPeter AG 17.0608 -61.7964 97928.0 23 0
4 Deaths 56 0 5/11/2020 Thailand Phetchabun AmphoeBuengSamPhan TH 15.87 100.993 69799978.0 0 56
In [57]:
# Filtering dataset only for June 04 
# tek respresents data only for June 04

cut = "6/4/2020"
tek  = final2[final2['Date'] == cut]
tek
Out[57]:
Case_Type Cases Difference Date Country_Region Province_State County_City Country_Code Latitude Longitude Population_Count Confirmed Deaths
437 Confirmed 3262 152 6/4/2020 Cote d'Ivoire ValleeduBandama ValleeduBandama CI 7.54 -5.5471 26378275.0 3262 0
447 Deaths 0 0 6/4/2020 Eritrea Debub Debub ER 15.1794 39.7823 3546427.0 0 0
719 Deaths 1 0 6/4/2020 France French Guiana Guyane GF 4 -53 298682.0 0 1
726 Confirmed 298 0 6/4/2020 Canada Manitoba Manitoba CA 53.7609 -98.8139 1377517.0 298 0
752 Confirmed 20 0 6/4/2020 France New Caledonia New Caledonia NC -20.9043 165.618 285491.0 20 0
... ... ... ... ... ... ... ... ... ... ... ... ... ...
948993 Deaths 5 0 6/4/2020 US New York Wyoming US 42.7015 -78.222 39859.0 0 5
949004 Deaths 10 0 6/4/2020 US Missouri Scott US 37.0559 -89.5647 38280.0 0 10
949172 Confirmed 792 25 6/4/2020 US California Stanislaus US 37.5586 -120.997 550660.0 792 0
949819 Confirmed 142 4 6/4/2020 US Texas Hardin US 30.3336 -94.3893 57602.0 142 0
949962 Deaths 0 0 6/4/2020 US Montana Roosevelt US 48.2961 -105.008 11004.0 0 0

7042 rows × 13 columns

In [58]:
#May is the dataframe for May month data only which is used in line chart
d1 = "5/1/2020"
d2 = "5/31/2020"
may  = final2[final2['Date'] >= d1]
may = may[may['Date'] <= d2]
In [59]:
may.head()
Out[59]:
Case_Type Cases Difference Date Country_Region Province_State County_City Country_Code Latitude Longitude Population_Count Confirmed Deaths
0 Confirmed 6 0 5/22/2020 Western Sahara Laayoune-Boujdour-SakiaElHamra Boujdour EH 24.2155 -12.8858 597330.0 6 0
4 Deaths 56 0 5/11/2020 Thailand Phetchabun AmphoeBuengSamPhan TH 15.87 100.993 69799978.0 0 56
10 Deaths 0 0 5/2/2020 Netherlands Bonaire, Sint Eustatius and Saba Bonaire, Sint Eustatius and Saba BQ 12.1784 -68.2385 26221.0 0 0
21 Deaths 6 0 5/10/2020 China Hebei Hebei CN 37.8957 114.904 75560000.0 0 6
23 Confirmed 18863 1041 5/14/2020 Bangladesh Dhaka Dhaka BD 23.685 90.3563 164689383.0 18863 0
In [60]:
##Summing the count of confirmed cases and deaths for all the countries and adding those to dataframe "coun"

coun = tek.groupby(['Country_Region'])[["Confirmed", "Deaths"]].sum()
coun
coun.reset_index(inplace = True)
In [61]:
## Filtering the data further from June 01 to June 04. 
##coun1 will have data for confirmed cases and death counts for countries on that particular date


k1 = "6/1/2020"
k2 = "6/4/2020"
coun1  = final2[final2['Date'] >= k1]
coun1 = coun1[coun1['Date'] <= k2]
coun1 = coun1.groupby(['Country_Region','Date'])[["Confirmed", "Deaths","Date"]].sum()
coun1.reset_index(inplace = True)
print(coun1)
                       Country_Region      Date  Confirmed  Deaths
0                         Afghanistan  6/1/2020      15750     265
1                         Afghanistan  6/2/2020      16509     270
2                         Afghanistan  6/3/2020      17267     294
3                         Afghanistan  6/4/2020      18054     300
4                             Albania  6/1/2020       1143      33
5                             Albania  6/2/2020       1164      33
6                             Albania  6/3/2020       1184      33
7                             Albania  6/4/2020       1197      33
8                             Algeria  6/1/2020       9513     661
9                             Algeria  6/2/2020       9626     667
10                            Algeria  6/3/2020       9733     673
11                            Algeria  6/4/2020       9831     681
12                            Andorra  6/1/2020        765      51
13                            Andorra  6/2/2020        844      51
14                            Andorra  6/3/2020        851      51
15                            Andorra  6/4/2020        852      51
16                             Angola  6/1/2020         86       4
17                             Angola  6/2/2020         86       4
18                             Angola  6/3/2020         86       4
19                             Angola  6/4/2020         86       4
20                Antigua and Barbuda  6/1/2020         26       3
21                Antigua and Barbuda  6/2/2020         26       3
22                Antigua and Barbuda  6/3/2020         26       3
23                Antigua and Barbuda  6/4/2020         26       3
24                          Argentina  6/1/2020      17415     556
25                          Argentina  6/2/2020      18319     569
26                          Argentina  6/3/2020      19268     583
27                          Argentina  6/4/2020      20197     608
28                            Armenia  6/1/2020       9492     139
29                            Armenia  6/2/2020      10009     158
30                            Armenia  6/3/2020      10524     170
31                            Armenia  6/4/2020      11221     176
32                          Australia  6/1/2020       7221     102
33                          Australia  6/2/2020       7229     102
34                          Australia  6/3/2020       7240     102
35                          Australia  6/4/2020       7247     102
36                            Austria  6/1/2020      16733     668
37                            Austria  6/2/2020      16759     669
38                            Austria  6/3/2020      16771     670
39                            Austria  6/4/2020      16805     670
40                         Azerbaijan  6/1/2020       5662      68
41                         Azerbaijan  6/2/2020       5935      71
42                         Azerbaijan  6/3/2020       6260      76
43                         Azerbaijan  6/4/2020       6522      78
44                            Bahamas  6/1/2020        102      11
45                            Bahamas  6/2/2020        102      11
46                            Bahamas  6/3/2020        102      11
47                            Bahamas  6/4/2020        102      11
48                            Bahrain  6/1/2020      11871      19
49                            Bahrain  6/2/2020      12311      19
50                            Bahrain  6/3/2020      12815      20
51                            Bahrain  6/4/2020      13296      21
52                         Bangladesh  6/1/2020      49534     672
53                         Bangladesh  6/2/2020      52445     709
54                         Bangladesh  6/3/2020      55140     746
55                         Bangladesh  6/4/2020      57563     781
56                           Barbados  6/1/2020         92       7
57                           Barbados  6/2/2020         92       7
58                           Barbados  6/3/2020         92       7
59                           Barbados  6/4/2020         92       7
60                            Belarus  6/1/2020      43403     240
61                            Belarus  6/2/2020      44255     243
62                            Belarus  6/3/2020      45116     248
63                            Belarus  6/4/2020      45981     253
64                            Belgium  6/1/2020      58517    9486
65                            Belgium  6/2/2020      58615    9505
66                            Belgium  6/3/2020      58685    9522
67                            Belgium  6/4/2020      58767    9548
68                             Belize  6/1/2020         18       2
69                             Belize  6/2/2020         18       2
70                             Belize  6/3/2020         18       2
71                             Belize  6/4/2020         18       2
72                              Benin  6/1/2020        243       3
73                              Benin  6/2/2020        244       3
74                              Benin  6/3/2020        244       3
75                              Benin  6/4/2020        261       3
76                             Bhutan  6/1/2020         43       0
77                             Bhutan  6/2/2020         47       0
78                             Bhutan  6/3/2020         47       0
79                             Bhutan  6/4/2020         47       0
80                            Bolivia  6/1/2020      10531     343
81                            Bolivia  6/2/2020      10991     376
82                            Bolivia  6/3/2020      11638     400
83                            Bolivia  6/4/2020      12245     415
84             Bosnia and Herzegovina  6/1/2020       2524     154
85             Bosnia and Herzegovina  6/2/2020       2535     157
86             Bosnia and Herzegovina  6/3/2020       2551     157
87             Bosnia and Herzegovina  6/4/2020       2594     159
88                           Botswana  6/1/2020         38       1
89                           Botswana  6/2/2020         40       1
90                           Botswana  6/3/2020         40       1
91                           Botswana  6/4/2020         40       1
92                             Brazil  6/1/2020     526447   29937
93                             Brazil  6/2/2020     555383   31199
94                             Brazil  6/3/2020     584016   32548
95                             Brazil  6/4/2020     614941   34021
96                             Brunei  6/1/2020        141       2
97                             Brunei  6/2/2020        141       2
98                             Brunei  6/3/2020        141       2
99                             Brunei  6/4/2020        141       2
100                          Bulgaria  6/1/2020       2519     140
101                          Bulgaria  6/2/2020       2538     144
102                          Bulgaria  6/3/2020       2560     146
103                          Bulgaria  6/4/2020       2585     147
104                      Burkina Faso  6/1/2020        847      53
105                      Burkina Faso  6/2/2020        881      53
106                      Burkina Faso  6/3/2020        884      53
107                      Burkina Faso  6/4/2020        885      53
108                             Burma  6/1/2020        228       6
109                             Burma  6/2/2020        232       6
110                             Burma  6/3/2020        233       6
111                             Burma  6/4/2020        236       6
112                           Burundi  6/1/2020         63       1
113                           Burundi  6/2/2020         63       1
114                           Burundi  6/3/2020         63       1
115                           Burundi  6/4/2020         63       1
116                        Cabo Verde  6/1/2020        458       4
117                        Cabo Verde  6/2/2020        466       5
118                        Cabo Verde  6/3/2020        477       5
119                        Cabo Verde  6/4/2020        502       5
120                          Cambodia  6/1/2020        125       0
121                          Cambodia  6/2/2020        125       0
122                          Cambodia  6/3/2020        125       0
123                          Cambodia  6/4/2020        125       0
124                          Cameroon  6/1/2020       6397     199
125                          Cameroon  6/2/2020       6585     200
126                          Cameroon  6/3/2020       6585     200
127                          Cameroon  6/4/2020       6789     203
128                            Canada  6/1/2020      93274    7403
129                            Canada  6/2/2020      93947    7477
130                            Canada  6/3/2020      94628    7578
131                            Canada  6/4/2020      95256    7716
132          Central African Republic  6/1/2020       1069       4
133          Central African Republic  6/2/2020       1069       4
134          Central African Republic  6/3/2020       1173       4
135          Central African Republic  6/4/2020       1288       4
136                              Chad  6/1/2020        790      66
137                              Chad  6/2/2020        803      66
138                              Chad  6/3/2020        820      66
139                              Chad  6/4/2020        828      66
140                             Chile  6/1/2020     105158    1113
141                             Chile  6/2/2020     108686    1188
142                             Chile  6/3/2020     113628    1275
143                             Chile  6/4/2020     118292    1356
144                             China  6/1/2020      84154    4638
145                             China  6/2/2020      84161    4638
146                             China  6/3/2020      84160    4638
147                             China  6/4/2020      84171    4638
148                          Colombia  6/1/2020      29384     963
149                          Colombia  6/2/2020      30593    1014
150                          Colombia  6/3/2020      31935    1057
151                          Colombia  6/4/2020      33466    1099
152                           Comoros  6/1/2020        106       2
153                           Comoros  6/2/2020        132       2
154                           Comoros  6/3/2020        132       2
155                           Comoros  6/4/2020        132       2
156               Congo (Brazzaville)  6/1/2020        611      20
157               Congo (Brazzaville)  6/2/2020        611      20
158               Congo (Brazzaville)  6/3/2020        611      20
159               Congo (Brazzaville)  6/4/2020        611      20
160                  Congo (Kinshasa)  6/1/2020       3195      72
161                  Congo (Kinshasa)  6/2/2020       3326      72
162                  Congo (Kinshasa)  6/3/2020       3495      75
163                  Congo (Kinshasa)  6/4/2020       3644      78
164                        Costa Rica  6/1/2020       1084      10
165                        Costa Rica  6/2/2020       1105      10
166                        Costa Rica  6/3/2020       1157      10
167                        Costa Rica  6/4/2020       1194      10
168                     Cote d'Ivoire  6/1/2020       2951      33
169                     Cote d'Ivoire  6/2/2020       3024      33
170                     Cote d'Ivoire  6/3/2020       3110      35
171                     Cote d'Ivoire  6/4/2020       3262      35
172                           Croatia  6/1/2020       2246     103
173                           Croatia  6/2/2020       2246     103
174                           Croatia  6/3/2020       2246     103
175                           Croatia  6/4/2020       2247     103
176                       Cruise Ship  6/1/2020        735      16
177                       Cruise Ship  6/2/2020        733      14
178                       Cruise Ship  6/3/2020        734      16
179                       Cruise Ship  6/4/2020        734      16
180                              Cuba  6/1/2020       2083      83
181                              Cuba  6/2/2020       2092      83
182                              Cuba  6/3/2020       2107      83
183                              Cuba  6/4/2020       2119      83
184                            Cyprus  6/1/2020        949      17
185                            Cyprus  6/2/2020        952      17
186                            Cyprus  6/3/2020        958      17
187                            Cyprus  6/4/2020        958      17
188                           Czechia  6/1/2020       9302     321
189                           Czechia  6/2/2020       9364     323
190                           Czechia  6/3/2020       9438     325
191                           Czechia  6/4/2020       9494     326
192                           Denmark  6/1/2020      11899     576
193                           Denmark  6/2/2020      11934     580
194                           Denmark  6/3/2020      11971     580
195                           Denmark  6/4/2020      12011     582
196                          Djibouti  6/1/2020       3569      24
197                          Djibouti  6/2/2020       3779      25
198                          Djibouti  6/3/2020       3935      26
199                          Djibouti  6/4/2020       4054      26
200                          Dominica  6/1/2020         16       0
201                          Dominica  6/2/2020         18       0
202                          Dominica  6/3/2020         18       0
203                          Dominica  6/4/2020         18       0
204                Dominican Republic  6/1/2020      17572     502
205                Dominican Republic  6/2/2020      17752     515
206                Dominican Republic  6/3/2020      18040     516
207                Dominican Republic  6/4/2020      18319     520
208                           Ecuador  6/1/2020      39098    3358
209                           Ecuador  6/2/2020      40414    3438
210                           Ecuador  6/3/2020      40966    3486
211                           Ecuador  6/4/2020      40966    3486
212                             Egypt  6/1/2020      26384    1005
213                             Egypt  6/2/2020      27536    1052
214                             Egypt  6/3/2020      28615    1088
215                             Egypt  6/4/2020      29767    1126
216                       El Salvador  6/1/2020       2582      46
217                       El Salvador  6/2/2020       2653      49
218                       El Salvador  6/3/2020       2705      51
219                       El Salvador  6/4/2020       2781      52
220                 Equatorial Guinea  6/1/2020       1306      12
221                 Equatorial Guinea  6/2/2020       1306      12
222                 Equatorial Guinea  6/3/2020       1306      12
223                 Equatorial Guinea  6/4/2020       1306      12
224                           Eritrea  6/1/2020         39       0
225                           Eritrea  6/2/2020         39       0
226                           Eritrea  6/3/2020         39       0
227                           Eritrea  6/4/2020         39       0
228                           Estonia  6/1/2020       1870      68
229                           Estonia  6/2/2020       1870      68
230                           Estonia  6/3/2020       1880      69
231                           Estonia  6/4/2020       1890      69
232                          Eswatini  6/1/2020        293       3
233                          Eswatini  6/2/2020        294       3
234                          Eswatini  6/3/2020        295       3
235                          Eswatini  6/4/2020        300       3
236                          Ethiopia  6/1/2020       1257      12
237                          Ethiopia  6/2/2020       1344      14
238                          Ethiopia  6/3/2020       1486      17
239                          Ethiopia  6/4/2020       1636      18
240                              Fiji  6/1/2020         18       0
241                              Fiji  6/2/2020         18       0
242                              Fiji  6/3/2020         18       0
243                              Fiji  6/4/2020         18       0
244                           Finland  6/1/2020       6885     318
245                           Finland  6/2/2020       6887     320
246                           Finland  6/3/2020       6911     321
247                           Finland  6/4/2020       6911     322
248                            France  6/1/2020     189348   28836
249                            France  6/2/2020     188450   28943
250                            France  6/3/2020     192330   29024
251                            France  6/4/2020     189569   29068
252                             Gabon  6/1/2020       2655      17
253                             Gabon  6/2/2020       2803      20
254                             Gabon  6/3/2020       2902      20
255                             Gabon  6/4/2020       2955      21
256                            Gambia  6/1/2020         25       1
257                            Gambia  6/2/2020         25       1
258                            Gambia  6/3/2020         26       1
259                            Gambia  6/4/2020         26       1
260                           Georgia  6/1/2020        794      12
261                           Georgia  6/2/2020        796      13
262                           Georgia  6/3/2020        800      13
263                           Georgia  6/4/2020        801      13
264                           Germany  6/1/2020     183594    8555
265                           Germany  6/2/2020     183879    8563
266                           Germany  6/3/2020     184121    8602
267                           Germany  6/4/2020     184472    8635
268                             Ghana  6/1/2020       8070      36
269                             Ghana  6/2/2020       8297      38
270                             Ghana  6/3/2020       8548      38
271                             Ghana  6/4/2020       8885      38
272                            Greece  6/1/2020       2918     179
273                            Greece  6/2/2020       2937     179
274                            Greece  6/3/2020       2937     179
275                            Greece  6/4/2020       2952     180
276                           Grenada  6/1/2020         23       0
277                           Grenada  6/2/2020         23       0
278                           Grenada  6/3/2020         23       0
279                           Grenada  6/4/2020         23       0
280                         Guatemala  6/1/2020       5336     116
281                         Guatemala  6/2/2020       5586     123
282                         Guatemala  6/3/2020       5760     143
283                         Guatemala  6/4/2020       6154     158
284                            Guinea  6/1/2020       3844      23
285                            Guinea  6/2/2020       3886      23
286                            Guinea  6/3/2020       3933      23
287                            Guinea  6/4/2020       3991      23
288                     Guinea-Bissau  6/1/2020       1339       8
289                     Guinea-Bissau  6/2/2020       1339       8
290                     Guinea-Bissau  6/3/2020       1339       8
291                     Guinea-Bissau  6/4/2020       1339       8
292                            Guyana  6/1/2020        153      12
293                            Guyana  6/2/2020        153      12
294                            Guyana  6/3/2020        153      12
295                            Guyana  6/4/2020        153      12
296                             Haiti  6/1/2020       2226      45
297                             Haiti  6/2/2020       2226      45
298                             Haiti  6/3/2020       2507      48
299                             Haiti  6/4/2020       2640      50
300                          Holy See  6/1/2020         12       0
301                          Holy See  6/2/2020         12       0
302                          Holy See  6/3/2020         12       0
303                          Holy See  6/4/2020         12       0
304                          Honduras  6/1/2020       5362     217
305                          Honduras  6/2/2020       5527     225
306                          Honduras  6/3/2020       5690     234
307                          Honduras  6/4/2020       5880     243
308                           Hungary  6/1/2020       3892     527
309                           Hungary  6/2/2020       3921     532
310                           Hungary  6/3/2020       3931     534
311                           Hungary  6/4/2020       3954     539
312                           Iceland  6/1/2020       1806      10
313                           Iceland  6/2/2020       1806      10
314                           Iceland  6/3/2020       1806      10
315                           Iceland  6/4/2020       1806      10
316                             India  6/1/2020     198370    5608
317                             India  6/2/2020     207191    5829
318                             India  6/3/2020     216824    6088
319                             India  6/4/2020     226713    6363
320                         Indonesia  6/1/2020      26940    1641
321                         Indonesia  6/2/2020      27549    1663
322                         Indonesia  6/3/2020      28233    1698
323                         Indonesia  6/4/2020      28818    1721
324                              Iran  6/1/2020     154445    7878
325                              Iran  6/2/2020     157562    7942
326                              Iran  6/3/2020     160696    8012
327                              Iran  6/4/2020     164270    8071
328                              Iraq  6/1/2020       6868     215
329                              Iraq  6/2/2020       7387     235
330                              Iraq  6/3/2020       8168     256
331                              Iraq  6/4/2020       8840     271
332                           Ireland  6/1/2020      25062    1650
333                           Ireland  6/2/2020      25066    1658
334                           Ireland  6/3/2020      25111    1659
335                           Ireland  6/4/2020      25142    1664
336                            Israel  6/1/2020      17169     285
337                            Israel  6/2/2020      17285     290
338                            Israel  6/3/2020      17377     291
339                            Israel  6/4/2020      17495     291
340                             Italy  6/1/2020     233197   33475
341                             Italy  6/2/2020     233515   33530
342                             Italy  6/3/2020     233836   33601
343                             Italy  6/4/2020     234013   33689
344                           Jamaica  6/1/2020        588       9
345                           Jamaica  6/2/2020        590       9
346                           Jamaica  6/3/2020        591      10
347                           Jamaica  6/4/2020        591      10
348                             Japan  6/1/2020      16787     899
349                             Japan  6/2/2020      16837     902
350                             Japan  6/3/2020      16867     905
351                             Japan  6/4/2020      16911     911
352                            Jordan  6/1/2020        746       9
353                            Jordan  6/2/2020        755       9
354                            Jordan  6/3/2020        757       9
355                            Jordan  6/4/2020        765       9
356                        Kazakhstan  6/1/2020      11308      41
357                        Kazakhstan  6/2/2020      11571      44
358                        Kazakhstan  6/3/2020      12067      48
359                        Kazakhstan  6/4/2020      12067      52
360                             Kenya  6/1/2020       2021      69
361                             Kenya  6/2/2020       2093      71
362                             Kenya  6/3/2020       2216      74
363                             Kenya  6/4/2020       2340      78
364                      Korea, South  6/1/2020      11541     272
365                      Korea, South  6/2/2020      11590     273
366                      Korea, South  6/3/2020      11629     273
367                      Korea, South  6/4/2020      11668     273
368                            Kosovo  6/1/2020       1064      30
369                            Kosovo  6/2/2020       1064      30
370                            Kosovo  6/3/2020       1142      30
371                            Kosovo  6/4/2020       1142      30
372                            Kuwait  6/1/2020      27762     220
373                            Kuwait  6/2/2020      28649     226
374                            Kuwait  6/3/2020      29359     230
375                            Kuwait  6/4/2020      29921     236
376                        Kyrgyzstan  6/1/2020       1817      16
377                        Kyrgyzstan  6/2/2020       1845      17
378                        Kyrgyzstan  6/3/2020       1871      20
379                        Kyrgyzstan  6/4/2020       1899      20
380                              Laos  6/1/2020         19       0
381                              Laos  6/2/2020         19       0
382                              Laos  6/3/2020         19       0
383                              Laos  6/4/2020         19       0
384                            Latvia  6/1/2020       1066      24
385                            Latvia  6/2/2020       1071      24
386                            Latvia  6/3/2020       1079      24
387                            Latvia  6/4/2020       1082      25
388                           Lebanon  6/1/2020       1233      27
389                           Lebanon  6/2/2020       1242      27
390                           Lebanon  6/3/2020       1256      27
391                           Lebanon  6/4/2020       1306      28
392                           Lesotho  6/1/2020          2       0
393                           Lesotho  6/2/2020          2       0
394                           Lesotho  6/3/2020          4       0
395                           Lesotho  6/4/2020          4       0
396                           Liberia  6/1/2020        296      27
397                           Liberia  6/2/2020        311      28
398                           Liberia  6/3/2020        316      28
399                           Liberia  6/4/2020        321      28
400                             Libya  6/1/2020        168       5
401                             Libya  6/2/2020        182       5
402                             Libya  6/3/2020        196       5
403                             Libya  6/4/2020        209       5
404                     Liechtenstein  6/1/2020         82       1
405                     Liechtenstein  6/2/2020         82       1
406                     Liechtenstein  6/3/2020         82       1
407                     Liechtenstein  6/4/2020         82       1
408                         Lithuania  6/1/2020       1678      70
409                         Lithuania  6/2/2020       1682      71
410                         Lithuania  6/3/2020       1684      71
411                         Lithuania  6/4/2020       1687      71
412                        Luxembourg  6/1/2020       4019     110
413                        Luxembourg  6/2/2020       4020     110
414                        Luxembourg  6/3/2020       4024     110
415                        Luxembourg  6/4/2020       4027     110
416                        Madagascar  6/1/2020        826       6
417                        Madagascar  6/2/2020        845       6
418                        Madagascar  6/3/2020        908       6
419                        Madagascar  6/4/2020        957       7
420                            Malawi  6/1/2020        336       4
421                            Malawi  6/2/2020        358       4
422                            Malawi  6/3/2020        369       4
423                            Malawi  6/4/2020        393       4
424                          Malaysia  6/1/2020       7857     115
425                          Malaysia  6/2/2020       7877     115
426                          Malaysia  6/3/2020       7970     115
427                          Malaysia  6/4/2020       8247     115
428                          Maldives  6/1/2020       1829       6
429                          Maldives  6/2/2020       1841       7
430                          Maldives  6/3/2020       1850       7
431                          Maldives  6/4/2020       1872       7
432                              Mali  6/1/2020       1315      78
433                              Mali  6/2/2020       1351      78
434                              Mali  6/3/2020       1386      79
435                              Mali  6/4/2020       1461      85
436                             Malta  6/1/2020        619       9
437                             Malta  6/2/2020        620       9
438                             Malta  6/3/2020        622       9
439                             Malta  6/4/2020        622       9
440                        Mauritania  6/1/2020        588      23
441                        Mauritania  6/2/2020        668      31
442                        Mauritania  6/3/2020        745      34
443                        Mauritania  6/4/2020        784      39
444                         Mauritius  6/1/2020        335      10
445                         Mauritius  6/2/2020        335      10
446                         Mauritius  6/3/2020        335      10
447                         Mauritius  6/4/2020        335      10
448                            Mexico  6/1/2020      93435   10167
449                            Mexico  6/2/2020      97326   10637
450                            Mexico  6/3/2020     101238   11729
451                            Mexico  6/4/2020     105680   12545
452                           Moldova  6/1/2020       8360     305
453                           Moldova  6/2/2020       8548     307
454                           Moldova  6/3/2020       8795     310
455                           Moldova  6/4/2020       9018     315
456                            Monaco  6/1/2020         99       4
457                            Monaco  6/2/2020         99       4
458                            Monaco  6/3/2020         99       4
459                            Monaco  6/4/2020         99       4
460                          Mongolia  6/1/2020        185       0
461                          Mongolia  6/2/2020        185       0
462                          Mongolia  6/3/2020        185       0
463                          Mongolia  6/4/2020        186       0
464                        Montenegro  6/1/2020        324       9
465                        Montenegro  6/2/2020        324       9
466                        Montenegro  6/3/2020        324       9
467                        Montenegro  6/4/2020        324       9
468                           Morocco  6/1/2020       7833     205
469                           Morocco  6/2/2020       7866     206
470                           Morocco  6/3/2020       7922     206
471                           Morocco  6/4/2020       8003     208
472                        Mozambique  6/1/2020        254       2
473                        Mozambique  6/2/2020        307       2
474                        Mozambique  6/3/2020        316       2
475                        Mozambique  6/4/2020        352       2
476                           Namibia  6/1/2020         25       0
477                           Namibia  6/2/2020         25       0
478                           Namibia  6/3/2020         25       0
479                           Namibia  6/4/2020         25       0
480                             Nepal  6/1/2020       1811       8
481                             Nepal  6/2/2020       2099       8
482                             Nepal  6/3/2020       2300       9
483                             Nepal  6/4/2020       2634      10
484                       Netherlands  6/1/2020      46749    5981
485                       Netherlands  6/2/2020      46852    5986
486                       Netherlands  6/3/2020      46939    5996
487                       Netherlands  6/4/2020      47148    6009
488                       New Zealand  6/1/2020       1504      22
489                       New Zealand  6/2/2020       1504      22
490                       New Zealand  6/3/2020       1504      22
491                       New Zealand  6/4/2020       1504      22
492                         Nicaragua  6/1/2020        759      35
493                         Nicaragua  6/2/2020       1118      46
494                         Nicaragua  6/3/2020       1118      46
495                         Nicaragua  6/4/2020       1118      46
496                             Niger  6/1/2020        958      65
497                             Niger  6/2/2020        960      65
498                             Niger  6/3/2020        961      65
499                             Niger  6/4/2020        963      65
500                           Nigeria  6/1/2020      10578     299
501                           Nigeria  6/2/2020      10819     314
502                           Nigeria  6/3/2020      11166     315
503                           Nigeria  6/4/2020      11516     323
504                   North Macedonia  6/1/2020       2315     140
505                   North Macedonia  6/2/2020       2391     141
506                   North Macedonia  6/3/2020       2492     145
507                   North Macedonia  6/4/2020       2611     147
508                            Norway  6/1/2020       8446     236
509                            Norway  6/2/2020       8455     237
510                            Norway  6/3/2020       8477     237
511                            Norway  6/4/2020       8504     238
512                              Oman  6/1/2020      12223      50
513                              Oman  6/2/2020      12799      59
514                              Oman  6/3/2020      13537      67
515                              Oman  6/4/2020      14316      67
516                          Pakistan  6/1/2020      72460    1543
517                          Pakistan  6/2/2020      76398    1621
518                          Pakistan  6/3/2020      80463    1688
519                          Pakistan  6/4/2020      85264    1770
520                            Panama  6/1/2020      13837     344
521                            Panama  6/2/2020      14095     352
522                            Panama  6/3/2020      14609     357
523                            Panama  6/4/2020      15044     363
524                  Papua New Guinea  6/1/2020          8       0
525                  Papua New Guinea  6/2/2020          8       0
526                  Papua New Guinea  6/3/2020          8       0
527                  Papua New Guinea  6/4/2020          8       0
528                          Paraguay  6/1/2020        995      11
529                          Paraguay  6/2/2020       1013      11
530                          Paraguay  6/3/2020       1070      11
531                          Paraguay  6/4/2020       1086      11
532                              Peru  6/1/2020     170039    4634
533                              Peru  6/2/2020     170039    4634
534                              Peru  6/3/2020     178914    4894
535                              Peru  6/4/2020     183198    5031
536                       Philippines  6/1/2020      18638     960
537                       Philippines  6/2/2020      18997     966
538                       Philippines  6/3/2020      19748     974
539                       Philippines  6/4/2020      20382     984
540                            Poland  6/1/2020      24165    1074
541                            Poland  6/2/2020      24395    1092
542                            Poland  6/3/2020      24687    1115
543                            Poland  6/4/2020      25048    1117
544                          Portugal  6/1/2020      32700    1424
545                          Portugal  6/2/2020      32895    1436
546                          Portugal  6/3/2020      33261    1447
547                          Portugal  6/4/2020      33592    1455
548                             Qatar  6/1/2020      58433      40
549                             Qatar  6/2/2020      60259      43
550                             Qatar  6/3/2020      62160      45
551                             Qatar  6/4/2020      63741      45
552                           Romania  6/1/2020      19398    1276
553                           Romania  6/2/2020      19517    1288
554                           Romania  6/3/2020      19669    1296
555                           Romania  6/4/2020      19907    1305
556                            Russia  6/1/2020     414328    4849
557                            Russia  6/2/2020     423186    5031
558                            Russia  6/3/2020     431715    5208
559                            Russia  6/4/2020     440538    5376
560                            Rwanda  6/1/2020        377       1
561                            Rwanda  6/2/2020        384       2
562                            Rwanda  6/3/2020        397       2
563                            Rwanda  6/4/2020        410       2
564             Saint Kitts and Nevis  6/1/2020         15       0
565             Saint Kitts and Nevis  6/2/2020         15       0
566             Saint Kitts and Nevis  6/3/2020         15       0
567             Saint Kitts and Nevis  6/4/2020         15       0
568                       Saint Lucia  6/1/2020         18       0
569                       Saint Lucia  6/2/2020         18       0
570                       Saint Lucia  6/3/2020         18       0
571                       Saint Lucia  6/4/2020         19       0
572  Saint Vincent and the Grenadines  6/1/2020         26       0
573  Saint Vincent and the Grenadines  6/2/2020         26       0
574  Saint Vincent and the Grenadines  6/3/2020         26       0
575  Saint Vincent and the Grenadines  6/4/2020         26       0
576                        San Marino  6/1/2020        671      42
577                        San Marino  6/2/2020        672      42
578                        San Marino  6/3/2020        674      42
579                        San Marino  6/4/2020        678      42
580             Sao Tome and Principe  6/1/2020        484      12
581             Sao Tome and Principe  6/2/2020        484      12
582             Sao Tome and Principe  6/3/2020        484      12
583             Sao Tome and Principe  6/4/2020        485      12
584                      Saudi Arabia  6/1/2020      87142     525
585                      Saudi Arabia  6/2/2020      89011     549
586                      Saudi Arabia  6/3/2020      91182     579
587                      Saudi Arabia  6/4/2020      93157     611
588                           Senegal  6/1/2020       3739      42
589                           Senegal  6/2/2020       3836      43
590                           Senegal  6/3/2020       3932      45
591                           Senegal  6/4/2020       4021      45
592                            Serbia  6/1/2020      11430     244
593                            Serbia  6/2/2020      11454     245
594                            Serbia  6/3/2020      11523     245
595                            Serbia  6/4/2020      11571     246
596                        Seychelles  6/1/2020         11       0
597                        Seychelles  6/2/2020         11       0
598                        Seychelles  6/3/2020         11       0
599                        Seychelles  6/4/2020         11       0
600                      Sierra Leone  6/1/2020        865      46
601                      Sierra Leone  6/2/2020        896      46
602                      Sierra Leone  6/3/2020        909      47
603                      Sierra Leone  6/4/2020        914      47
604                         Singapore  6/1/2020      35292      24
605                         Singapore  6/2/2020      35836      24
606                         Singapore  6/3/2020      36405      24
607                         Singapore  6/4/2020      36922      24
608                          Slovakia  6/1/2020       1522      28
609                          Slovakia  6/2/2020       1522      28
610                          Slovakia  6/3/2020       1525      28
611                          Slovakia  6/4/2020       1526      28
612                          Slovenia  6/1/2020       1473     109
613                          Slovenia  6/2/2020       1475     109
614                          Slovenia  6/3/2020       1477     109
615                          Slovenia  6/4/2020       1477     109
616                           Somalia  6/1/2020       2023      79
617                           Somalia  6/2/2020       2089      79
618                           Somalia  6/3/2020       2146      79
619                           Somalia  6/4/2020       2204      79
620                      South Africa  6/1/2020      34357     705
621                      South Africa  6/2/2020      35812     755
622                      South Africa  6/3/2020      37525     792
623                      South Africa  6/4/2020      40792     848
624                       South Sudan  6/1/2020        994      10
625                       South Sudan  6/2/2020        994      10
626                       South Sudan  6/3/2020        994      10
627                       South Sudan  6/4/2020        994      10
628                             Spain  6/1/2020     239638   27127
629                             Spain  6/2/2020     239932   27127
630                             Spain  6/3/2020     240326   27128
631                             Spain  6/4/2020     240660   27133
632                         Sri Lanka  6/1/2020       1643      11
633                         Sri Lanka  6/2/2020       1683      11
634                         Sri Lanka  6/3/2020       1749      11
635                         Sri Lanka  6/4/2020       1797      11
636                             Sudan  6/1/2020       5173     298
637                             Sudan  6/2/2020       5310     307
638                             Sudan  6/3/2020       5499     314
639                             Sudan  6/4/2020       5714     333
640                          Suriname  6/1/2020         44       1
641                          Suriname  6/2/2020         54       1
642                          Suriname  6/3/2020         74       1
643                          Suriname  6/4/2020         82       1
644                            Sweden  6/1/2020      37814    4403
645                            Sweden  6/2/2020      38589    4468
646                            Sweden  6/3/2020      40803    4542
647                            Sweden  6/4/2020      41883    4562
648                       Switzerland  6/1/2020      30871    1920
649                       Switzerland  6/2/2020      30874    1920
650                       Switzerland  6/3/2020      30893    1921
651                       Switzerland  6/4/2020      30913    1921
652                             Syria  6/1/2020        123       5
653                             Syria  6/2/2020        123       6
654                             Syria  6/3/2020        123       6
655                             Syria  6/4/2020        124       6
656                           Taiwan*  6/1/2020        443       7
657                           Taiwan*  6/2/2020        443       7
658                           Taiwan*  6/3/2020        443       7
659                           Taiwan*  6/4/2020        443       7
660                        Tajikistan  6/1/2020       4013      47
661                        Tajikistan  6/2/2020       4100      47
662                        Tajikistan  6/3/2020       4191      48
663                        Tajikistan  6/4/2020       4289      48
664                          Tanzania  6/1/2020        509      21
665                          Tanzania  6/2/2020        509      21
666                          Tanzania  6/3/2020        509      21
667                          Tanzania  6/4/2020        509      21
668                          Thailand  6/1/2020       3082      57
669                          Thailand  6/2/2020       3083      58
670                          Thailand  6/3/2020       3084      58
671                          Thailand  6/4/2020       3101      58
672                       Timor-Leste  6/1/2020         24       0
673                       Timor-Leste  6/2/2020         24       0
674                       Timor-Leste  6/3/2020         24       0
675                       Timor-Leste  6/4/2020         24       0
676                              Togo  6/1/2020        443      13
677                              Togo  6/2/2020        445      13
678                              Togo  6/3/2020        452      13
679                              Togo  6/4/2020        465      13
680               Trinidad and Tobago  6/1/2020        117       8
681               Trinidad and Tobago  6/2/2020        117       8
682               Trinidad and Tobago  6/3/2020        117       8
683               Trinidad and Tobago  6/4/2020        117       8
684                           Tunisia  6/1/2020       1084      48
685                           Tunisia  6/2/2020       1086      48
686                           Tunisia  6/3/2020       1087      49
687                           Tunisia  6/4/2020       1087      49
688                            Turkey  6/1/2020     164769    4563
689                            Turkey  6/2/2020     165555    4585
690                            Turkey  6/3/2020     166422    4609
691                            Turkey  6/4/2020     167410    4630
692                                US  6/1/2020    1810868  105146
693                                US  6/2/2020    1831669  106177
694                                US  6/3/2020    1851368  107172
695                                US  6/4/2020    1872508  108208
696                            Uganda  6/1/2020        457       0
697                            Uganda  6/2/2020        489       0
698                            Uganda  6/3/2020        507       0
699                            Uganda  6/4/2020        522       0
700                           Ukraine  6/1/2020      24562     724
701                           Ukraine  6/2/2020      24895     733
702                           Ukraine  6/3/2020      25385     742
703                           Ukraine  6/4/2020      25981     755
704              United Arab Emirates  6/1/2020      35192     266
705              United Arab Emirates  6/2/2020      35788     269
706              United Arab Emirates  6/3/2020      36359     270
707              United Arab Emirates  6/4/2020      37018     273
708                    United Kingdom  6/1/2020     277736   39127
709                    United Kingdom  6/2/2020     279392   39452
710                    United Kingdom  6/3/2020     281270   39811
711                    United Kingdom  6/4/2020     283079   39987
712                           Uruguay  6/1/2020        825      23
713                           Uruguay  6/2/2020        826      23
714                           Uruguay  6/3/2020        828      23
715                           Uruguay  6/4/2020        832      23
716                        Uzbekistan  6/1/2020       3702      15
717                        Uzbekistan  6/2/2020       3760      15
718                        Uzbekistan  6/3/2020       3843      16
719                        Uzbekistan  6/4/2020       3939      16
720                         Venezuela  6/1/2020       1662      17
721                         Venezuela  6/2/2020       1819      18
722                         Venezuela  6/3/2020       1952      20
723                         Venezuela  6/4/2020       2087      20
724                           Vietnam  6/1/2020        328       0
725                           Vietnam  6/2/2020        328       0
726                           Vietnam  6/3/2020        328       0
727                           Vietnam  6/4/2020        328       0
728                West Bank and Gaza  6/1/2020        449       3
729                West Bank and Gaza  6/2/2020        451       3
730                West Bank and Gaza  6/3/2020        457       3
731                West Bank and Gaza  6/4/2020        464       3
732                    Western Sahara  6/1/2020          9       1
733                    Western Sahara  6/2/2020          9       1
734                    Western Sahara  6/3/2020          9       1
735                    Western Sahara  6/4/2020          9       1
736                             Yemen  6/1/2020        354      84
737                             Yemen  6/2/2020        399      87
738                             Yemen  6/3/2020        419      95
739                             Yemen  6/4/2020        453     103
740                            Zambia  6/1/2020       1089       7
741                            Zambia  6/2/2020       1089       7
742                            Zambia  6/3/2020       1089       7
743                            Zambia  6/4/2020       1089       7
744                          Zimbabwe  6/1/2020        203       4
745                          Zimbabwe  6/2/2020        206       4
746                          Zimbabwe  6/3/2020        222       4
747                          Zimbabwe  6/4/2020        237       4
In [62]:
# Filtering the data only for few countries to have deeper analysis on data 
# THese countries seem to have high number of Covid cases at that time

countries = ['Canada', 'Germany', 'United Kingdom', 'US', 'France', 'China','India','Italy','Brazil','Russia','Spain']
df = coun[coun['Country_Region'].isin(countries)]
df['Cases'] = df[['Confirmed', 'Deaths']].sum(axis=1)
C:\Users\suraj\Anaconda3\lib\site-packages\ipykernel_launcher.py:6: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
  
In [63]:
df = df.rename(columns={"Country_Region": "Country"})
In [64]:
df.reset_index(inplace = True)
In [65]:
df
Out[65]:
index Country Confirmed Deaths Cases
0 23 Brazil 614941 34021 648962
1 32 Canada 95256 7716 102972
2 36 China 84171 4638 88809
3 62 France 189569 29068 218637
4 66 Germany 184472 8635 193107
5 79 India 226713 6363 233076
6 85 Italy 234013 33689 267702
7 139 Russia 440538 5376 445914
8 157 Spain 240660 27133 267793
9 173 US 1872508 108208 1980716
10 177 United Kingdom 283079 39987 323066

Line Chart 1

Chart is plotted using two dataframes

1.prop ->countries having death count more than 5000

2.tek ->dataset representing filtered data for current date(June 04)

Chart represents total no of Confirmed cases, active cases, and deaths for countries having death count more than 5K

In [66]:
import pandas as pd
import matplotlib.pyplot as plt
coun['Active'] = coun['Confirmed'] - coun['Deaths']
 
prop = coun.sort_values(by='Deaths', ascending=False)
prop = prop[prop['Deaths']>5000]
plt.figure(figsize=(15, 5))
plt.plot(prop['Country_Region'], prop['Deaths'],color='red', label = 'Deaths')
plt.plot(prop['Country_Region'], prop['Confirmed'],color='green', label = 'Confirmed Cases')
plt.plot(prop['Country_Region'], prop['Active'], color='black', label='Active Cases')
plt.plot()
##plt.plot(x2, y2, label='Second Line')
 
plt.title('Total Deaths(>5000), Confirmed, Recovered and Active Cases by Country')
plt.legend()
plt.show()

Line Chart 2

This chart is representing total no of Confirmed Covid cases across all the countries for May Month

In [67]:
d1 = "5/1/2020"
d2 = "5/31/2020"
may  = final2[final2['Date'] >= d1]
may = may[may['Date'] <= d2]
In [68]:
import pandas as pd
import plotly.express as px
import plotly.io as pio
import matplotlib.dates as mdates     #date formatting
pio.templates.default = "plotly_dark"

may['Date'] = pd.to_datetime(may['Date']) 
sortBYDate = may.sort_values(by='Date') 
 
grouped = sortBYDate.groupby('Date')['Date', 'Confirmed'].sum().reset_index()

fig = px.line(grouped, x="Date", y="Confirmed",
             title="Worldwide Confirmed Novel Coronavirus(COVID-19) Cases Over Time")
fig.show()
C:\Users\suraj\Anaconda3\lib\site-packages\ipykernel_launcher.py:10: FutureWarning: Indexing with multiple keys (implicitly converted to a tuple of keys) will be deprecated, use a list instead.
  # Remove the CWD from sys.path while we load stuff.

Bar Chart 1

This chart is representing Number of novel coronavirus (COVID-19) deaths worldwide as of June 4, 2020

In [69]:
import pandas as pd
import plotly.express as px

df = df[df.sum(axis = 1) > 0]
df.sort_values('Deaths',inplace=True)
#df = df.groupby(['Country'])['Deaths'].sum().reset_index()
state_fig = px.bar(df, x='Country', y='Deaths', title='Number of novel coronavirus (COVID-19) deaths worldwide as of June 4, 2020', text='Deaths')
state_fig.show()
In [70]:
import pandas as pd
import numpy as np
import matplotlib.ticker as ticker
import matplotlib.pyplot as plt

Horizontal Bar Chart 2

Chart represents total no of Confirmed cases for the countries having death count more than 5K

In [71]:
#plotting the initial horizontal barchart 
fig, ax = plt.subplots(figsize=(15, 8))
ax.barh(prop['Country_Region'], prop['Confirmed'])
plt.xlabel('Number of Confirmend Cases')
plt.ylabel('Country')
Out[71]:
Text(0, 0.5, 'Country')

Horizontal Bar Chart 3

  1. Chart represents total no of Confirmed cases for the US states

  2. Among US states , New York and Illinois had highest no of Covid cases as of June 04

In [72]:
#plotting the initial horizontal barchart 
fig, ax = plt.subplots(figsize=(15, 8))
us_data1 = tek[tek['Country_Region']=='US']
ax.barh(us_data1['Province_State'], us_data1['Confirmed'])
plt.xlabel('Number of Confirmed Cases')
plt.ylabel('US States')
Out[72]:
Text(0, 0.5, 'US States')

Vertical Bar Chart 4

In [73]:
import plotly as py
import plotly.express as px

us_data = tek[tek['Country_Region']=='US']
us_data = us_data[us_data.sum(axis = 1) > 0]
 
us_data = us_data.groupby(['Province_State'])['Confirmed'].sum().reset_index()
us_data_death = us_data[us_data['Confirmed'] > 0]
state_fig = px.bar(us_data_death, x='Province_State', y='Confirmed', title='State wise cases of COVID-19 in USA', text='Confirmed')
state_fig.show()

Preparation for Heat Map

We need not deal with any country where there are no confirmed corona cases. So, we will drop the rows where is no coronavirus confirmed cases.

In [74]:
#filtering data for the countries having count more than 0 for better analysis
modified_confirmed = coun1[coun1.Confirmed > 0]

The first plot reveals that the majority of values of countries are reduced to one level

So, we 're plotting the values with the values log10, it reveals more spread in nature. It indicates that if we use the original number of confirmed incidents, we can't differentiate between the map colours. As most countries will be plotted with identical color types. For better results we have to use the log10 value of our dataset.

In [75]:
plt.subplots(figsize=(26,8))
plt.subplot(1,2,1)  # rows columns index
(modified_confirmed.Confirmed).plot.kde()
plt.subplot(1,2,2)   # returns fig and ax
(np.log10(modified_confirmed.Confirmed)).plot.kde()
Out[75]:
<matplotlib.axes._subplots.AxesSubplot at 0x2342108bc08>

we have added a column below named Affected_Factor to the dataframe based on the log10 value of Confirmed cases.

In [76]:
modified_confirmed['Affected_Factor'] = np.log10(modified_confirmed.Confirmed)

print(modified_confirmed)
                       Country_Region      Date  Confirmed  Deaths  \
0                         Afghanistan  6/1/2020      15750     265   
1                         Afghanistan  6/2/2020      16509     270   
2                         Afghanistan  6/3/2020      17267     294   
3                         Afghanistan  6/4/2020      18054     300   
4                             Albania  6/1/2020       1143      33   
5                             Albania  6/2/2020       1164      33   
6                             Albania  6/3/2020       1184      33   
7                             Albania  6/4/2020       1197      33   
8                             Algeria  6/1/2020       9513     661   
9                             Algeria  6/2/2020       9626     667   
10                            Algeria  6/3/2020       9733     673   
11                            Algeria  6/4/2020       9831     681   
12                            Andorra  6/1/2020        765      51   
13                            Andorra  6/2/2020        844      51   
14                            Andorra  6/3/2020        851      51   
15                            Andorra  6/4/2020        852      51   
16                             Angola  6/1/2020         86       4   
17                             Angola  6/2/2020         86       4   
18                             Angola  6/3/2020         86       4   
19                             Angola  6/4/2020         86       4   
20                Antigua and Barbuda  6/1/2020         26       3   
21                Antigua and Barbuda  6/2/2020         26       3   
22                Antigua and Barbuda  6/3/2020         26       3   
23                Antigua and Barbuda  6/4/2020         26       3   
24                          Argentina  6/1/2020      17415     556   
25                          Argentina  6/2/2020      18319     569   
26                          Argentina  6/3/2020      19268     583   
27                          Argentina  6/4/2020      20197     608   
28                            Armenia  6/1/2020       9492     139   
29                            Armenia  6/2/2020      10009     158   
30                            Armenia  6/3/2020      10524     170   
31                            Armenia  6/4/2020      11221     176   
32                          Australia  6/1/2020       7221     102   
33                          Australia  6/2/2020       7229     102   
34                          Australia  6/3/2020       7240     102   
35                          Australia  6/4/2020       7247     102   
36                            Austria  6/1/2020      16733     668   
37                            Austria  6/2/2020      16759     669   
38                            Austria  6/3/2020      16771     670   
39                            Austria  6/4/2020      16805     670   
40                         Azerbaijan  6/1/2020       5662      68   
41                         Azerbaijan  6/2/2020       5935      71   
42                         Azerbaijan  6/3/2020       6260      76   
43                         Azerbaijan  6/4/2020       6522      78   
44                            Bahamas  6/1/2020        102      11   
45                            Bahamas  6/2/2020        102      11   
46                            Bahamas  6/3/2020        102      11   
47                            Bahamas  6/4/2020        102      11   
48                            Bahrain  6/1/2020      11871      19   
49                            Bahrain  6/2/2020      12311      19   
50                            Bahrain  6/3/2020      12815      20   
51                            Bahrain  6/4/2020      13296      21   
52                         Bangladesh  6/1/2020      49534     672   
53                         Bangladesh  6/2/2020      52445     709   
54                         Bangladesh  6/3/2020      55140     746   
55                         Bangladesh  6/4/2020      57563     781   
56                           Barbados  6/1/2020         92       7   
57                           Barbados  6/2/2020         92       7   
58                           Barbados  6/3/2020         92       7   
59                           Barbados  6/4/2020         92       7   
60                            Belarus  6/1/2020      43403     240   
61                            Belarus  6/2/2020      44255     243   
62                            Belarus  6/3/2020      45116     248   
63                            Belarus  6/4/2020      45981     253   
64                            Belgium  6/1/2020      58517    9486   
65                            Belgium  6/2/2020      58615    9505   
66                            Belgium  6/3/2020      58685    9522   
67                            Belgium  6/4/2020      58767    9548   
68                             Belize  6/1/2020         18       2   
69                             Belize  6/2/2020         18       2   
70                             Belize  6/3/2020         18       2   
71                             Belize  6/4/2020         18       2   
72                              Benin  6/1/2020        243       3   
73                              Benin  6/2/2020        244       3   
74                              Benin  6/3/2020        244       3   
75                              Benin  6/4/2020        261       3   
76                             Bhutan  6/1/2020         43       0   
77                             Bhutan  6/2/2020         47       0   
78                             Bhutan  6/3/2020         47       0   
79                             Bhutan  6/4/2020         47       0   
80                            Bolivia  6/1/2020      10531     343   
81                            Bolivia  6/2/2020      10991     376   
82                            Bolivia  6/3/2020      11638     400   
83                            Bolivia  6/4/2020      12245     415   
84             Bosnia and Herzegovina  6/1/2020       2524     154   
85             Bosnia and Herzegovina  6/2/2020       2535     157   
86             Bosnia and Herzegovina  6/3/2020       2551     157   
87             Bosnia and Herzegovina  6/4/2020       2594     159   
88                           Botswana  6/1/2020         38       1   
89                           Botswana  6/2/2020         40       1   
90                           Botswana  6/3/2020         40       1   
91                           Botswana  6/4/2020         40       1   
92                             Brazil  6/1/2020     526447   29937   
93                             Brazil  6/2/2020     555383   31199   
94                             Brazil  6/3/2020     584016   32548   
95                             Brazil  6/4/2020     614941   34021   
96                             Brunei  6/1/2020        141       2   
97                             Brunei  6/2/2020        141       2   
98                             Brunei  6/3/2020        141       2   
99                             Brunei  6/4/2020        141       2   
100                          Bulgaria  6/1/2020       2519     140   
101                          Bulgaria  6/2/2020       2538     144   
102                          Bulgaria  6/3/2020       2560     146   
103                          Bulgaria  6/4/2020       2585     147   
104                      Burkina Faso  6/1/2020        847      53   
105                      Burkina Faso  6/2/2020        881      53   
106                      Burkina Faso  6/3/2020        884      53   
107                      Burkina Faso  6/4/2020        885      53   
108                             Burma  6/1/2020        228       6   
109                             Burma  6/2/2020        232       6   
110                             Burma  6/3/2020        233       6   
111                             Burma  6/4/2020        236       6   
112                           Burundi  6/1/2020         63       1   
113                           Burundi  6/2/2020         63       1   
114                           Burundi  6/3/2020         63       1   
115                           Burundi  6/4/2020         63       1   
116                        Cabo Verde  6/1/2020        458       4   
117                        Cabo Verde  6/2/2020        466       5   
118                        Cabo Verde  6/3/2020        477       5   
119                        Cabo Verde  6/4/2020        502       5   
120                          Cambodia  6/1/2020        125       0   
121                          Cambodia  6/2/2020        125       0   
122                          Cambodia  6/3/2020        125       0   
123                          Cambodia  6/4/2020        125       0   
124                          Cameroon  6/1/2020       6397     199   
125                          Cameroon  6/2/2020       6585     200   
126                          Cameroon  6/3/2020       6585     200   
127                          Cameroon  6/4/2020       6789     203   
128                            Canada  6/1/2020      93274    7403   
129                            Canada  6/2/2020      93947    7477   
130                            Canada  6/3/2020      94628    7578   
131                            Canada  6/4/2020      95256    7716   
132          Central African Republic  6/1/2020       1069       4   
133          Central African Republic  6/2/2020       1069       4   
134          Central African Republic  6/3/2020       1173       4   
135          Central African Republic  6/4/2020       1288       4   
136                              Chad  6/1/2020        790      66   
137                              Chad  6/2/2020        803      66   
138                              Chad  6/3/2020        820      66   
139                              Chad  6/4/2020        828      66   
140                             Chile  6/1/2020     105158    1113   
141                             Chile  6/2/2020     108686    1188   
142                             Chile  6/3/2020     113628    1275   
143                             Chile  6/4/2020     118292    1356   
144                             China  6/1/2020      84154    4638   
145                             China  6/2/2020      84161    4638   
146                             China  6/3/2020      84160    4638   
147                             China  6/4/2020      84171    4638   
148                          Colombia  6/1/2020      29384     963   
149                          Colombia  6/2/2020      30593    1014   
150                          Colombia  6/3/2020      31935    1057   
151                          Colombia  6/4/2020      33466    1099   
152                           Comoros  6/1/2020        106       2   
153                           Comoros  6/2/2020        132       2   
154                           Comoros  6/3/2020        132       2   
155                           Comoros  6/4/2020        132       2   
156               Congo (Brazzaville)  6/1/2020        611      20   
157               Congo (Brazzaville)  6/2/2020        611      20   
158               Congo (Brazzaville)  6/3/2020        611      20   
159               Congo (Brazzaville)  6/4/2020        611      20   
160                  Congo (Kinshasa)  6/1/2020       3195      72   
161                  Congo (Kinshasa)  6/2/2020       3326      72   
162                  Congo (Kinshasa)  6/3/2020       3495      75   
163                  Congo (Kinshasa)  6/4/2020       3644      78   
164                        Costa Rica  6/1/2020       1084      10   
165                        Costa Rica  6/2/2020       1105      10   
166                        Costa Rica  6/3/2020       1157      10   
167                        Costa Rica  6/4/2020       1194      10   
168                     Cote d'Ivoire  6/1/2020       2951      33   
169                     Cote d'Ivoire  6/2/2020       3024      33   
170                     Cote d'Ivoire  6/3/2020       3110      35   
171                     Cote d'Ivoire  6/4/2020       3262      35   
172                           Croatia  6/1/2020       2246     103   
173                           Croatia  6/2/2020       2246     103   
174                           Croatia  6/3/2020       2246     103   
175                           Croatia  6/4/2020       2247     103   
176                       Cruise Ship  6/1/2020        735      16   
177                       Cruise Ship  6/2/2020        733      14   
178                       Cruise Ship  6/3/2020        734      16   
179                       Cruise Ship  6/4/2020        734      16   
180                              Cuba  6/1/2020       2083      83   
181                              Cuba  6/2/2020       2092      83   
182                              Cuba  6/3/2020       2107      83   
183                              Cuba  6/4/2020       2119      83   
184                            Cyprus  6/1/2020        949      17   
185                            Cyprus  6/2/2020        952      17   
186                            Cyprus  6/3/2020        958      17   
187                            Cyprus  6/4/2020        958      17   
188                           Czechia  6/1/2020       9302     321   
189                           Czechia  6/2/2020       9364     323   
190                           Czechia  6/3/2020       9438     325   
191                           Czechia  6/4/2020       9494     326   
192                           Denmark  6/1/2020      11899     576   
193                           Denmark  6/2/2020      11934     580   
194                           Denmark  6/3/2020      11971     580   
195                           Denmark  6/4/2020      12011     582   
196                          Djibouti  6/1/2020       3569      24   
197                          Djibouti  6/2/2020       3779      25   
198                          Djibouti  6/3/2020       3935      26   
199                          Djibouti  6/4/2020       4054      26   
200                          Dominica  6/1/2020         16       0   
201                          Dominica  6/2/2020         18       0   
202                          Dominica  6/3/2020         18       0   
203                          Dominica  6/4/2020         18       0   
204                Dominican Republic  6/1/2020      17572     502   
205                Dominican Republic  6/2/2020      17752     515   
206                Dominican Republic  6/3/2020      18040     516   
207                Dominican Republic  6/4/2020      18319     520   
208                           Ecuador  6/1/2020      39098    3358   
209                           Ecuador  6/2/2020      40414    3438   
210                           Ecuador  6/3/2020      40966    3486   
211                           Ecuador  6/4/2020      40966    3486   
212                             Egypt  6/1/2020      26384    1005   
213                             Egypt  6/2/2020      27536    1052   
214                             Egypt  6/3/2020      28615    1088   
215                             Egypt  6/4/2020      29767    1126   
216                       El Salvador  6/1/2020       2582      46   
217                       El Salvador  6/2/2020       2653      49   
218                       El Salvador  6/3/2020       2705      51   
219                       El Salvador  6/4/2020       2781      52   
220                 Equatorial Guinea  6/1/2020       1306      12   
221                 Equatorial Guinea  6/2/2020       1306      12   
222                 Equatorial Guinea  6/3/2020       1306      12   
223                 Equatorial Guinea  6/4/2020       1306      12   
224                           Eritrea  6/1/2020         39       0   
225                           Eritrea  6/2/2020         39       0   
226                           Eritrea  6/3/2020         39       0   
227                           Eritrea  6/4/2020         39       0   
228                           Estonia  6/1/2020       1870      68   
229                           Estonia  6/2/2020       1870      68   
230                           Estonia  6/3/2020       1880      69   
231                           Estonia  6/4/2020       1890      69   
232                          Eswatini  6/1/2020        293       3   
233                          Eswatini  6/2/2020        294       3   
234                          Eswatini  6/3/2020        295       3   
235                          Eswatini  6/4/2020        300       3   
236                          Ethiopia  6/1/2020       1257      12   
237                          Ethiopia  6/2/2020       1344      14   
238                          Ethiopia  6/3/2020       1486      17   
239                          Ethiopia  6/4/2020       1636      18   
240                              Fiji  6/1/2020         18       0   
241                              Fiji  6/2/2020         18       0   
242                              Fiji  6/3/2020         18       0   
243                              Fiji  6/4/2020         18       0   
244                           Finland  6/1/2020       6885     318   
245                           Finland  6/2/2020       6887     320   
246                           Finland  6/3/2020       6911     321   
247                           Finland  6/4/2020       6911     322   
248                            France  6/1/2020     189348   28836   
249                            France  6/2/2020     188450   28943   
250                            France  6/3/2020     192330   29024   
251                            France  6/4/2020     189569   29068   
252                             Gabon  6/1/2020       2655      17   
253                             Gabon  6/2/2020       2803      20   
254                             Gabon  6/3/2020       2902      20   
255                             Gabon  6/4/2020       2955      21   
256                            Gambia  6/1/2020         25       1   
257                            Gambia  6/2/2020         25       1   
258                            Gambia  6/3/2020         26       1   
259                            Gambia  6/4/2020         26       1   
260                           Georgia  6/1/2020        794      12   
261                           Georgia  6/2/2020        796      13   
262                           Georgia  6/3/2020        800      13   
263                           Georgia  6/4/2020        801      13   
264                           Germany  6/1/2020     183594    8555   
265                           Germany  6/2/2020     183879    8563   
266                           Germany  6/3/2020     184121    8602   
267                           Germany  6/4/2020     184472    8635   
268                             Ghana  6/1/2020       8070      36   
269                             Ghana  6/2/2020       8297      38   
270                             Ghana  6/3/2020       8548      38   
271                             Ghana  6/4/2020       8885      38   
272                            Greece  6/1/2020       2918     179   
273                            Greece  6/2/2020       2937     179   
274                            Greece  6/3/2020       2937     179   
275                            Greece  6/4/2020       2952     180   
276                           Grenada  6/1/2020         23       0   
277                           Grenada  6/2/2020         23       0   
278                           Grenada  6/3/2020         23       0   
279                           Grenada  6/4/2020         23       0   
280                         Guatemala  6/1/2020       5336     116   
281                         Guatemala  6/2/2020       5586     123   
282                         Guatemala  6/3/2020       5760     143   
283                         Guatemala  6/4/2020       6154     158   
284                            Guinea  6/1/2020       3844      23   
285                            Guinea  6/2/2020       3886      23   
286                            Guinea  6/3/2020       3933      23   
287                            Guinea  6/4/2020       3991      23   
288                     Guinea-Bissau  6/1/2020       1339       8   
289                     Guinea-Bissau  6/2/2020       1339       8   
290                     Guinea-Bissau  6/3/2020       1339       8   
291                     Guinea-Bissau  6/4/2020       1339       8   
292                            Guyana  6/1/2020        153      12   
293                            Guyana  6/2/2020        153      12   
294                            Guyana  6/3/2020        153      12   
295                            Guyana  6/4/2020        153      12   
296                             Haiti  6/1/2020       2226      45   
297                             Haiti  6/2/2020       2226      45   
298                             Haiti  6/3/2020       2507      48   
299                             Haiti  6/4/2020       2640      50   
300                          Holy See  6/1/2020         12       0   
301                          Holy See  6/2/2020         12       0   
302                          Holy See  6/3/2020         12       0   
303                          Holy See  6/4/2020         12       0   
304                          Honduras  6/1/2020       5362     217   
305                          Honduras  6/2/2020       5527     225   
306                          Honduras  6/3/2020       5690     234   
307                          Honduras  6/4/2020       5880     243   
308                           Hungary  6/1/2020       3892     527   
309                           Hungary  6/2/2020       3921     532   
310                           Hungary  6/3/2020       3931     534   
311                           Hungary  6/4/2020       3954     539   
312                           Iceland  6/1/2020       1806      10   
313                           Iceland  6/2/2020       1806      10   
314                           Iceland  6/3/2020       1806      10   
315                           Iceland  6/4/2020       1806      10   
316                             India  6/1/2020     198370    5608   
317                             India  6/2/2020     207191    5829   
318                             India  6/3/2020     216824    6088   
319                             India  6/4/2020     226713    6363   
320                         Indonesia  6/1/2020      26940    1641   
321                         Indonesia  6/2/2020      27549    1663   
322                         Indonesia  6/3/2020      28233    1698   
323                         Indonesia  6/4/2020      28818    1721   
324                              Iran  6/1/2020     154445    7878   
325                              Iran  6/2/2020     157562    7942   
326                              Iran  6/3/2020     160696    8012   
327                              Iran  6/4/2020     164270    8071   
328                              Iraq  6/1/2020       6868     215   
329                              Iraq  6/2/2020       7387     235   
330                              Iraq  6/3/2020       8168     256   
331                              Iraq  6/4/2020       8840     271   
332                           Ireland  6/1/2020      25062    1650   
333                           Ireland  6/2/2020      25066    1658   
334                           Ireland  6/3/2020      25111    1659   
335                           Ireland  6/4/2020      25142    1664   
336                            Israel  6/1/2020      17169     285   
337                            Israel  6/2/2020      17285     290   
338                            Israel  6/3/2020      17377     291   
339                            Israel  6/4/2020      17495     291   
340                             Italy  6/1/2020     233197   33475   
341                             Italy  6/2/2020     233515   33530   
342                             Italy  6/3/2020     233836   33601   
343                             Italy  6/4/2020     234013   33689   
344                           Jamaica  6/1/2020        588       9   
345                           Jamaica  6/2/2020        590       9   
346                           Jamaica  6/3/2020        591      10   
347                           Jamaica  6/4/2020        591      10   
348                             Japan  6/1/2020      16787     899   
349                             Japan  6/2/2020      16837     902   
350                             Japan  6/3/2020      16867     905   
351                             Japan  6/4/2020      16911     911   
352                            Jordan  6/1/2020        746       9   
353                            Jordan  6/2/2020        755       9   
354                            Jordan  6/3/2020        757       9   
355                            Jordan  6/4/2020        765       9   
356                        Kazakhstan  6/1/2020      11308      41   
357                        Kazakhstan  6/2/2020      11571      44   
358                        Kazakhstan  6/3/2020      12067      48   
359                        Kazakhstan  6/4/2020      12067      52   
360                             Kenya  6/1/2020       2021      69   
361                             Kenya  6/2/2020       2093      71   
362                             Kenya  6/3/2020       2216      74   
363                             Kenya  6/4/2020       2340      78   
364                      Korea, South  6/1/2020      11541     272   
365                      Korea, South  6/2/2020      11590     273   
366                      Korea, South  6/3/2020      11629     273   
367                      Korea, South  6/4/2020      11668     273   
368                            Kosovo  6/1/2020       1064      30   
369                            Kosovo  6/2/2020       1064      30   
370                            Kosovo  6/3/2020       1142      30   
371                            Kosovo  6/4/2020       1142      30   
372                            Kuwait  6/1/2020      27762     220   
373                            Kuwait  6/2/2020      28649     226   
374                            Kuwait  6/3/2020      29359     230   
375                            Kuwait  6/4/2020      29921     236   
376                        Kyrgyzstan  6/1/2020       1817      16   
377                        Kyrgyzstan  6/2/2020       1845      17   
378                        Kyrgyzstan  6/3/2020       1871      20   
379                        Kyrgyzstan  6/4/2020       1899      20   
380                              Laos  6/1/2020         19       0   
381                              Laos  6/2/2020         19       0   
382                              Laos  6/3/2020         19       0   
383                              Laos  6/4/2020         19       0   
384                            Latvia  6/1/2020       1066      24   
385                            Latvia  6/2/2020       1071      24   
386                            Latvia  6/3/2020       1079      24   
387                            Latvia  6/4/2020       1082      25   
388                           Lebanon  6/1/2020       1233      27   
389                           Lebanon  6/2/2020       1242      27   
390                           Lebanon  6/3/2020       1256      27   
391                           Lebanon  6/4/2020       1306      28   
392                           Lesotho  6/1/2020          2       0   
393                           Lesotho  6/2/2020          2       0   
394                           Lesotho  6/3/2020          4       0   
395                           Lesotho  6/4/2020          4       0   
396                           Liberia  6/1/2020        296      27   
397                           Liberia  6/2/2020        311      28   
398                           Liberia  6/3/2020        316      28   
399                           Liberia  6/4/2020        321      28   
400                             Libya  6/1/2020        168       5   
401                             Libya  6/2/2020        182       5   
402                             Libya  6/3/2020        196       5   
403                             Libya  6/4/2020        209       5   
404                     Liechtenstein  6/1/2020         82       1   
405                     Liechtenstein  6/2/2020         82       1   
406                     Liechtenstein  6/3/2020         82       1   
407                     Liechtenstein  6/4/2020         82       1   
408                         Lithuania  6/1/2020       1678      70   
409                         Lithuania  6/2/2020       1682      71   
410                         Lithuania  6/3/2020       1684      71   
411                         Lithuania  6/4/2020       1687      71   
412                        Luxembourg  6/1/2020       4019     110   
413                        Luxembourg  6/2/2020       4020     110   
414                        Luxembourg  6/3/2020       4024     110   
415                        Luxembourg  6/4/2020       4027     110   
416                        Madagascar  6/1/2020        826       6   
417                        Madagascar  6/2/2020        845       6   
418                        Madagascar  6/3/2020        908       6   
419                        Madagascar  6/4/2020        957       7   
420                            Malawi  6/1/2020        336       4   
421                            Malawi  6/2/2020        358       4   
422                            Malawi  6/3/2020        369       4   
423                            Malawi  6/4/2020        393       4   
424                          Malaysia  6/1/2020       7857     115   
425                          Malaysia  6/2/2020       7877     115   
426                          Malaysia  6/3/2020       7970     115   
427                          Malaysia  6/4/2020       8247     115   
428                          Maldives  6/1/2020       1829       6   
429                          Maldives  6/2/2020       1841       7   
430                          Maldives  6/3/2020       1850       7   
431                          Maldives  6/4/2020       1872       7   
432                              Mali  6/1/2020       1315      78   
433                              Mali  6/2/2020       1351      78   
434                              Mali  6/3/2020       1386      79   
435                              Mali  6/4/2020       1461      85   
436                             Malta  6/1/2020        619       9   
437                             Malta  6/2/2020        620       9   
438                             Malta  6/3/2020        622       9   
439                             Malta  6/4/2020        622       9   
440                        Mauritania  6/1/2020        588      23   
441                        Mauritania  6/2/2020        668      31   
442                        Mauritania  6/3/2020        745      34   
443                        Mauritania  6/4/2020        784      39   
444                         Mauritius  6/1/2020        335      10   
445                         Mauritius  6/2/2020        335      10   
446                         Mauritius  6/3/2020        335      10   
447                         Mauritius  6/4/2020        335      10   
448                            Mexico  6/1/2020      93435   10167   
449                            Mexico  6/2/2020      97326   10637   
450                            Mexico  6/3/2020     101238   11729   
451                            Mexico  6/4/2020     105680   12545   
452                           Moldova  6/1/2020       8360     305   
453                           Moldova  6/2/2020       8548     307   
454                           Moldova  6/3/2020       8795     310   
455                           Moldova  6/4/2020       9018     315   
456                            Monaco  6/1/2020         99       4   
457                            Monaco  6/2/2020         99       4   
458                            Monaco  6/3/2020         99       4   
459                            Monaco  6/4/2020         99       4   
460                          Mongolia  6/1/2020        185       0   
461                          Mongolia  6/2/2020        185       0   
462                          Mongolia  6/3/2020        185       0   
463                          Mongolia  6/4/2020        186       0   
464                        Montenegro  6/1/2020        324       9   
465                        Montenegro  6/2/2020        324       9   
466                        Montenegro  6/3/2020        324       9   
467                        Montenegro  6/4/2020        324       9   
468                           Morocco  6/1/2020       7833     205   
469                           Morocco  6/2/2020       7866     206   
470                           Morocco  6/3/2020       7922     206   
471                           Morocco  6/4/2020       8003     208   
472                        Mozambique  6/1/2020        254       2   
473                        Mozambique  6/2/2020        307       2   
474                        Mozambique  6/3/2020        316       2   
475                        Mozambique  6/4/2020        352       2   
476                           Namibia  6/1/2020         25       0   
477                           Namibia  6/2/2020         25       0   
478                           Namibia  6/3/2020         25       0   
479                           Namibia  6/4/2020         25       0   
480                             Nepal  6/1/2020       1811       8   
481                             Nepal  6/2/2020       2099       8   
482                             Nepal  6/3/2020       2300       9   
483                             Nepal  6/4/2020       2634      10   
484                       Netherlands  6/1/2020      46749    5981   
485                       Netherlands  6/2/2020      46852    5986   
486                       Netherlands  6/3/2020      46939    5996   
487                       Netherlands  6/4/2020      47148    6009   
488                       New Zealand  6/1/2020       1504      22   
489                       New Zealand  6/2/2020       1504      22   
490                       New Zealand  6/3/2020       1504      22   
491                       New Zealand  6/4/2020       1504      22   
492                         Nicaragua  6/1/2020        759      35   
493                         Nicaragua  6/2/2020       1118      46   
494                         Nicaragua  6/3/2020       1118      46   
495                         Nicaragua  6/4/2020       1118      46   
496                             Niger  6/1/2020        958      65   
497                             Niger  6/2/2020        960      65   
498                             Niger  6/3/2020        961      65   
499                             Niger  6/4/2020        963      65   
500                           Nigeria  6/1/2020      10578     299   
501                           Nigeria  6/2/2020      10819     314   
502                           Nigeria  6/3/2020      11166     315   
503                           Nigeria  6/4/2020      11516     323   
504                   North Macedonia  6/1/2020       2315     140   
505                   North Macedonia  6/2/2020       2391     141   
506                   North Macedonia  6/3/2020       2492     145   
507                   North Macedonia  6/4/2020       2611     147   
508                            Norway  6/1/2020       8446     236   
509                            Norway  6/2/2020       8455     237   
510                            Norway  6/3/2020       8477     237   
511                            Norway  6/4/2020       8504     238   
512                              Oman  6/1/2020      12223      50   
513                              Oman  6/2/2020      12799      59   
514                              Oman  6/3/2020      13537      67   
515                              Oman  6/4/2020      14316      67   
516                          Pakistan  6/1/2020      72460    1543   
517                          Pakistan  6/2/2020      76398    1621   
518                          Pakistan  6/3/2020      80463    1688   
519                          Pakistan  6/4/2020      85264    1770   
520                            Panama  6/1/2020      13837     344   
521                            Panama  6/2/2020      14095     352   
522                            Panama  6/3/2020      14609     357   
523                            Panama  6/4/2020      15044     363   
524                  Papua New Guinea  6/1/2020          8       0   
525                  Papua New Guinea  6/2/2020          8       0   
526                  Papua New Guinea  6/3/2020          8       0   
527                  Papua New Guinea  6/4/2020          8       0   
528                          Paraguay  6/1/2020        995      11   
529                          Paraguay  6/2/2020       1013      11   
530                          Paraguay  6/3/2020       1070      11   
531                          Paraguay  6/4/2020       1086      11   
532                              Peru  6/1/2020     170039    4634   
533                              Peru  6/2/2020     170039    4634   
534                              Peru  6/3/2020     178914    4894   
535                              Peru  6/4/2020     183198    5031   
536                       Philippines  6/1/2020      18638     960   
537                       Philippines  6/2/2020      18997     966   
538                       Philippines  6/3/2020      19748     974   
539                       Philippines  6/4/2020      20382     984   
540                            Poland  6/1/2020      24165    1074   
541                            Poland  6/2/2020      24395    1092   
542                            Poland  6/3/2020      24687    1115   
543                            Poland  6/4/2020      25048    1117   
544                          Portugal  6/1/2020      32700    1424   
545                          Portugal  6/2/2020      32895    1436   
546                          Portugal  6/3/2020      33261    1447   
547                          Portugal  6/4/2020      33592    1455   
548                             Qatar  6/1/2020      58433      40   
549                             Qatar  6/2/2020      60259      43   
550                             Qatar  6/3/2020      62160      45   
551                             Qatar  6/4/2020      63741      45   
552                           Romania  6/1/2020      19398    1276   
553                           Romania  6/2/2020      19517    1288   
554                           Romania  6/3/2020      19669    1296   
555                           Romania  6/4/2020      19907    1305   
556                            Russia  6/1/2020     414328    4849   
557                            Russia  6/2/2020     423186    5031   
558                            Russia  6/3/2020     431715    5208   
559                            Russia  6/4/2020     440538    5376   
560                            Rwanda  6/1/2020        377       1   
561                            Rwanda  6/2/2020        384       2   
562                            Rwanda  6/3/2020        397       2   
563                            Rwanda  6/4/2020        410       2   
564             Saint Kitts and Nevis  6/1/2020         15       0   
565             Saint Kitts and Nevis  6/2/2020         15       0   
566             Saint Kitts and Nevis  6/3/2020         15       0   
567             Saint Kitts and Nevis  6/4/2020         15       0   
568                       Saint Lucia  6/1/2020         18       0   
569                       Saint Lucia  6/2/2020         18       0   
570                       Saint Lucia  6/3/2020         18       0   
571                       Saint Lucia  6/4/2020         19       0   
572  Saint Vincent and the Grenadines  6/1/2020         26       0   
573  Saint Vincent and the Grenadines  6/2/2020         26       0   
574  Saint Vincent and the Grenadines  6/3/2020         26       0   
575  Saint Vincent and the Grenadines  6/4/2020         26       0   
576                        San Marino  6/1/2020        671      42   
577                        San Marino  6/2/2020        672      42   
578                        San Marino  6/3/2020        674      42   
579                        San Marino  6/4/2020        678      42   
580             Sao Tome and Principe  6/1/2020        484      12   
581             Sao Tome and Principe  6/2/2020        484      12   
582             Sao Tome and Principe  6/3/2020        484      12   
583             Sao Tome and Principe  6/4/2020        485      12   
584                      Saudi Arabia  6/1/2020      87142     525   
585                      Saudi Arabia  6/2/2020      89011     549   
586                      Saudi Arabia  6/3/2020      91182     579   
587                      Saudi Arabia  6/4/2020      93157     611   
588                           Senegal  6/1/2020       3739      42   
589                           Senegal  6/2/2020       3836      43   
590                           Senegal  6/3/2020       3932      45   
591                           Senegal  6/4/2020       4021      45   
592                            Serbia  6/1/2020      11430     244   
593                            Serbia  6/2/2020      11454     245   
594                            Serbia  6/3/2020      11523     245   
595                            Serbia  6/4/2020      11571     246   
596                        Seychelles  6/1/2020         11       0   
597                        Seychelles  6/2/2020         11       0   
598                        Seychelles  6/3/2020         11       0   
599                        Seychelles  6/4/2020         11       0   
600                      Sierra Leone  6/1/2020        865      46   
601                      Sierra Leone  6/2/2020        896      46   
602                      Sierra Leone  6/3/2020        909      47   
603                      Sierra Leone  6/4/2020        914      47   
604                         Singapore  6/1/2020      35292      24   
605                         Singapore  6/2/2020      35836      24   
606                         Singapore  6/3/2020      36405      24   
607                         Singapore  6/4/2020      36922      24   
608                          Slovakia  6/1/2020       1522      28   
609                          Slovakia  6/2/2020       1522      28   
610                          Slovakia  6/3/2020       1525      28   
611                          Slovakia  6/4/2020       1526      28   
612                          Slovenia  6/1/2020       1473     109   
613                          Slovenia  6/2/2020       1475     109   
614                          Slovenia  6/3/2020       1477     109   
615                          Slovenia  6/4/2020       1477     109   
616                           Somalia  6/1/2020       2023      79   
617                           Somalia  6/2/2020       2089      79   
618                           Somalia  6/3/2020       2146      79   
619                           Somalia  6/4/2020       2204      79   
620                      South Africa  6/1/2020      34357     705   
621                      South Africa  6/2/2020      35812     755   
622                      South Africa  6/3/2020      37525     792   
623                      South Africa  6/4/2020      40792     848   
624                       South Sudan  6/1/2020        994      10   
625                       South Sudan  6/2/2020        994      10   
626                       South Sudan  6/3/2020        994      10   
627                       South Sudan  6/4/2020        994      10   
628                             Spain  6/1/2020     239638   27127   
629                             Spain  6/2/2020     239932   27127   
630                             Spain  6/3/2020     240326   27128   
631                             Spain  6/4/2020     240660   27133   
632                         Sri Lanka  6/1/2020       1643      11   
633                         Sri Lanka  6/2/2020       1683      11   
634                         Sri Lanka  6/3/2020       1749      11   
635                         Sri Lanka  6/4/2020       1797      11   
636                             Sudan  6/1/2020       5173     298   
637                             Sudan  6/2/2020       5310     307   
638                             Sudan  6/3/2020       5499     314   
639                             Sudan  6/4/2020       5714     333   
640                          Suriname  6/1/2020         44       1   
641                          Suriname  6/2/2020         54       1   
642                          Suriname  6/3/2020         74       1   
643                          Suriname  6/4/2020         82       1   
644                            Sweden  6/1/2020      37814    4403   
645                            Sweden  6/2/2020      38589    4468   
646                            Sweden  6/3/2020      40803    4542   
647                            Sweden  6/4/2020      41883    4562   
648                       Switzerland  6/1/2020      30871    1920   
649                       Switzerland  6/2/2020      30874    1920   
650                       Switzerland  6/3/2020      30893    1921   
651                       Switzerland  6/4/2020      30913    1921   
652                             Syria  6/1/2020        123       5   
653                             Syria  6/2/2020        123       6   
654                             Syria  6/3/2020        123       6   
655                             Syria  6/4/2020        124       6   
656                           Taiwan*  6/1/2020        443       7   
657                           Taiwan*  6/2/2020        443       7   
658                           Taiwan*  6/3/2020        443       7   
659                           Taiwan*  6/4/2020        443       7   
660                        Tajikistan  6/1/2020       4013      47   
661                        Tajikistan  6/2/2020       4100      47   
662                        Tajikistan  6/3/2020       4191      48   
663                        Tajikistan  6/4/2020       4289      48   
664                          Tanzania  6/1/2020        509      21   
665                          Tanzania  6/2/2020        509      21   
666                          Tanzania  6/3/2020        509      21   
667                          Tanzania  6/4/2020        509      21   
668                          Thailand  6/1/2020       3082      57   
669                          Thailand  6/2/2020       3083      58   
670                          Thailand  6/3/2020       3084      58   
671                          Thailand  6/4/2020       3101      58   
672                       Timor-Leste  6/1/2020         24       0   
673                       Timor-Leste  6/2/2020         24       0   
674                       Timor-Leste  6/3/2020         24       0   
675                       Timor-Leste  6/4/2020         24       0   
676                              Togo  6/1/2020        443      13   
677                              Togo  6/2/2020        445      13   
678                              Togo  6/3/2020        452      13   
679                              Togo  6/4/2020        465      13   
680               Trinidad and Tobago  6/1/2020        117       8   
681               Trinidad and Tobago  6/2/2020        117       8   
682               Trinidad and Tobago  6/3/2020        117       8   
683               Trinidad and Tobago  6/4/2020        117       8   
684                           Tunisia  6/1/2020       1084      48   
685                           Tunisia  6/2/2020       1086      48   
686                           Tunisia  6/3/2020       1087      49   
687                           Tunisia  6/4/2020       1087      49   
688                            Turkey  6/1/2020     164769    4563   
689                            Turkey  6/2/2020     165555    4585   
690                            Turkey  6/3/2020     166422    4609   
691                            Turkey  6/4/2020     167410    4630   
692                                US  6/1/2020    1810868  105146   
693                                US  6/2/2020    1831669  106177   
694                                US  6/3/2020    1851368  107172   
695                                US  6/4/2020    1872508  108208   
696                            Uganda  6/1/2020        457       0   
697                            Uganda  6/2/2020        489       0   
698                            Uganda  6/3/2020        507       0   
699                            Uganda  6/4/2020        522       0   
700                           Ukraine  6/1/2020      24562     724   
701                           Ukraine  6/2/2020      24895     733   
702                           Ukraine  6/3/2020      25385     742   
703                           Ukraine  6/4/2020      25981     755   
704              United Arab Emirates  6/1/2020      35192     266   
705              United Arab Emirates  6/2/2020      35788     269   
706              United Arab Emirates  6/3/2020      36359     270   
707              United Arab Emirates  6/4/2020      37018     273   
708                    United Kingdom  6/1/2020     277736   39127   
709                    United Kingdom  6/2/2020     279392   39452   
710                    United Kingdom  6/3/2020     281270   39811   
711                    United Kingdom  6/4/2020     283079   39987   
712                           Uruguay  6/1/2020        825      23   
713                           Uruguay  6/2/2020        826      23   
714                           Uruguay  6/3/2020        828      23   
715                           Uruguay  6/4/2020        832      23   
716                        Uzbekistan  6/1/2020       3702      15   
717                        Uzbekistan  6/2/2020       3760      15   
718                        Uzbekistan  6/3/2020       3843      16   
719                        Uzbekistan  6/4/2020       3939      16   
720                         Venezuela  6/1/2020       1662      17   
721                         Venezuela  6/2/2020       1819      18   
722                         Venezuela  6/3/2020       1952      20   
723                         Venezuela  6/4/2020       2087      20   
724                           Vietnam  6/1/2020        328       0   
725                           Vietnam  6/2/2020        328       0   
726                           Vietnam  6/3/2020        328       0   
727                           Vietnam  6/4/2020        328       0   
728                West Bank and Gaza  6/1/2020        449       3   
729                West Bank and Gaza  6/2/2020        451       3   
730                West Bank and Gaza  6/3/2020        457       3   
731                West Bank and Gaza  6/4/2020        464       3   
732                    Western Sahara  6/1/2020          9       1   
733                    Western Sahara  6/2/2020          9       1   
734                    Western Sahara  6/3/2020          9       1   
735                    Western Sahara  6/4/2020          9       1   
736                             Yemen  6/1/2020        354      84   
737                             Yemen  6/2/2020        399      87   
738                             Yemen  6/3/2020        419      95   
739                             Yemen  6/4/2020        453     103   
740                            Zambia  6/1/2020       1089       7   
741                            Zambia  6/2/2020       1089       7   
742                            Zambia  6/3/2020       1089       7   
743                            Zambia  6/4/2020       1089       7   
744                          Zimbabwe  6/1/2020        203       4   
745                          Zimbabwe  6/2/2020        206       4   
746                          Zimbabwe  6/3/2020        222       4   
747                          Zimbabwe  6/4/2020        237       4   

     Affected_Factor  
0           4.197281  
1           4.217721  
2           4.237217  
3           4.256573  
4           3.058046  
5           3.065953  
6           3.073352  
7           3.078094  
8           3.978317  
9           3.983446  
10          3.988247  
11          3.992598  
12          2.883661  
13          2.926342  
14          2.929930  
15          2.930440  
16          1.934498  
17          1.934498  
18          1.934498  
19          1.934498  
20          1.414973  
21          1.414973  
22          1.414973  
23          1.414973  
24          4.240923  
25          4.262902  
26          4.284837  
27          4.305287  
28          3.977358  
29          4.000391  
30          4.022181  
31          4.050032  
32          3.858597  
33          3.859078  
34          3.859739  
35          3.860158  
36          4.223574  
37          4.224248  
38          4.224559  
39          4.225439  
40          3.752970  
41          3.773421  
42          3.796574  
43          3.814381  
44          2.008600  
45          2.008600  
46          2.008600  
47          2.008600  
48          4.074487  
49          4.090293  
50          4.107719  
51          4.123721  
52          4.694903  
53          4.719704  
54          4.741467  
55          4.760143  
56          1.963788  
57          1.963788  
58          1.963788  
59          1.963788  
60          4.637520  
61          4.645962  
62          4.654331  
63          4.662578  
64          4.767282  
65          4.768009  
66          4.768527  
67          4.769134  
68          1.255273  
69          1.255273  
70          1.255273  
71          1.255273  
72          2.385606  
73          2.387390  
74          2.387390  
75          2.416641  
76          1.633468  
77          1.672098  
78          1.672098  
79          1.672098  
80          4.022470  
81          4.041037  
82          4.065878  
83          4.087959  
84          3.402089  
85          3.403978  
86          3.406710  
87          3.413970  
88          1.579784  
89          1.602060  
90          1.602060  
91          1.602060  
92          5.721355  
93          5.744593  
94          5.766425  
95          5.788833  
96          2.149219  
97          2.149219  
98          2.149219  
99          2.149219  
100         3.401228  
101         3.404492  
102         3.408240  
103         3.412461  
104         2.927883  
105         2.944976  
106         2.946452  
107         2.946943  
108         2.357935  
109         2.365488  
110         2.367356  
111         2.372912  
112         1.799341  
113         1.799341  
114         1.799341  
115         1.799341  
116         2.660865  
117         2.668386  
118         2.678518  
119         2.700704  
120         2.096910  
121         2.096910  
122         2.096910  
123         2.096910  
124         3.805976  
125         3.818556  
126         3.818556  
127         3.831806  
128         4.969761  
129         4.972883  
130         4.976020  
131         4.978892  
132         3.028978  
133         3.028978  
134         3.069298  
135         3.109916  
136         2.897627  
137         2.904716  
138         2.913814  
139         2.918030  
140         5.021842  
141         5.036174  
142         5.055485  
143         5.072955  
144         4.925075  
145         4.925111  
146         4.925106  
147         4.925162  
148         4.468111  
149         4.485622  
150         4.504267  
151         4.524604  
152         2.025306  
153         2.120574  
154         2.120574  
155         2.120574  
156         2.786041  
157         2.786041  
158         2.786041  
159         2.786041  
160         3.504471  
161         3.521922  
162         3.543447  
163         3.561578  
164         3.035029  
165         3.043362  
166         3.063333  
167         3.077004  
168         3.469969  
169         3.480582  
170         3.492760  
171         3.513484  
172         3.351410  
173         3.351410  
174         3.351410  
175         3.351603  
176         2.866287  
177         2.865104  
178         2.865696  
179         2.865696  
180         3.318689  
181         3.320562  
182         3.323665  
183         3.326131  
184         2.977266  
185         2.978637  
186         2.981366  
187         2.981366  
188         3.968576  
189         3.971461  
190         3.974880  
191         3.977449  
192         4.075510  
193         4.076786  
194         4.078130  
195         4.079579  
196         3.552547  
197         3.577377  
198         3.594945  
199         3.607884  
200         1.204120  
201         1.255273  
202         1.255273  
203         1.255273  
204         4.244821  
205         4.249247  
206         4.256237  
207         4.262902  
208         4.592155  
209         4.606532  
210         4.612424  
211         4.612424  
212         4.421341  
213         4.439901  
214         4.456594  
215         4.473735  
216         3.411956  
217         3.423737  
218         3.432167  
219         3.444201  
220         3.115943  
221         3.115943  
222         3.115943  
223         3.115943  
224         1.591065  
225         1.591065  
226         1.591065  
227         1.591065  
228         3.271842  
229         3.271842  
230         3.274158  
231         3.276462  
232         2.466868  
233         2.468347  
234         2.469822  
235         2.477121  
236         3.099335  
237         3.128399  
238         3.172019  
239         3.213783  
240         1.255273  
241         1.255273  
242         1.255273  
243         1.255273  
244         3.837904  
245         3.838030  
246         3.839541  
247         3.839541  
248         5.277261  
249         5.275196  
250         5.284047  
251         5.277767  
252         3.424065  
253         3.447623  
254         3.462697  
255         3.470557  
256         1.397940  
257         1.397940  
258         1.414973  
259         1.414973  
260         2.899821  
261         2.900913  
262         2.903090  
263         2.903633  
264         5.263858  
265         5.264532  
266         5.265103  
267         5.265930  
268         3.906874  
269         3.918921  
270         3.931865  
271         3.948657  
272         3.465085  
273         3.467904  
274         3.467904  
275         3.470116  
276         1.361728  
277         1.361728  
278         1.361728  
279         1.361728  
280         3.727216  
281         3.747101  
282         3.760422  
283         3.789157  
284         3.584783  
285         3.589503  
286         3.594724  
287         3.601082  
288         3.126781  
289         3.126781  
290         3.126781  
291         3.126781  
292         2.184691  
293         2.184691  
294         2.184691  
295         2.184691  
296         3.347525  
297         3.347525  
298         3.399154  
299         3.421604  
300         1.079181  
301         1.079181  
302         1.079181  
303         1.079181  
304         3.729327  
305         3.742489  
306         3.755112  
307         3.769377  
308         3.590173  
309         3.593397  
310         3.594503  
311         3.597037  
312         3.256718  
313         3.256718  
314         3.256718  
315         3.256718  
316         5.297476  
317         5.316371  
318         5.336107  
319         5.355476  
320         4.430398  
321         4.440106  
322         4.450757  
323         4.459664  
324         5.188774  
325         5.197451  
326         5.206005  
327         5.215558  
328         3.836830  
329         3.868468  
330         3.912116  
331         3.946452  
332         4.399016  
333         4.399085  
334         4.399864  
335         4.400400  
336         4.234745  
337         4.237669  
338         4.239975  
339         4.242914  
340         5.367723  
341         5.368315  
342         5.368911  
343         5.369240  
344         2.769377  
345         2.770852  
346         2.771587  
347         2.771587  
348         4.224973  
349         4.226265  
350         4.227038  
351         4.228169  
352         2.872739  
353         2.877947  
354         2.879096  
355         2.883661  
356         4.053386  
357         4.063371  
358         4.081599  
359         4.081599  
360         3.305566  
361         3.320769  
362         3.345570  
363         3.369216  
364         4.062243  
365         4.064083  
366         4.065542  
367         4.066996  
368         3.026942  
369         3.026942  
370         3.057666  
371         3.057666  
372         4.443451  
373         4.457109  
374         4.467741  
375         4.475976  
376         3.259355  
377         3.265996  
378         3.272074  
379         3.278525  
380         1.278754  
381         1.278754  
382         1.278754  
383         1.278754  
384         3.027757  
385         3.029789  
386         3.033021  
387         3.034227  
388         3.090963  
389         3.094122  
390         3.098990  
391         3.115943  
392         0.301030  
393         0.301030  
394         0.602060  
395         0.602060  
396         2.471292  
397         2.492760  
398         2.499687  
399         2.506505  
400         2.225309  
401         2.260071  
402         2.292256  
403         2.320146  
404         1.913814  
405         1.913814  
406         1.913814  
407         1.913814  
408         3.224792  
409         3.225826  
410         3.226342  
411         3.227115  
412         3.604118  
413         3.604226  
414         3.604658  
415         3.604982  
416         2.916980  
417         2.926857  
418         2.958086  
419         2.980912  
420         2.526339  
421         2.553883  
422         2.567026  
423         2.594393  
424         3.895257  
425         3.896361  
426         3.901458  
427         3.916296  
428         3.262214  
429         3.265054  
430         3.267172  
431         3.272306  
432         3.118926  
433         3.130655  
434         3.141763  
435         3.164650  
436         2.791691  
437         2.792392  
438         2.793790  
439         2.793790  
440         2.769377  
441         2.824776  
442         2.872156  
443         2.894316  
444         2.525045  
445         2.525045  
446         2.525045  
447         2.525045  
448         4.970510  
449         4.988229  
450         5.005344  
451         5.023993  
452         3.922206  
453         3.931865  
454         3.944236  
455         3.955110  
456         1.995635  
457         1.995635  
458         1.995635  
459         1.995635  
460         2.267172  
461         2.267172  
462         2.267172  
463         2.269513  
464         2.510545  
465         2.510545  
466         2.510545  
467         2.510545  
468         3.893928  
469         3.895754  
470         3.898835  
471         3.903253  
472         2.404834  
473         2.487138  
474         2.499687  
475         2.546543  
476         1.397940  
477         1.397940  
478         1.397940  
479         1.397940  
480         3.257918  
481         3.322012  
482         3.361728  
483         3.420616  
484         4.669772  
485         4.670728  
486         4.671534  
487         4.673463  
488         3.177248  
489         3.177248  
490         3.177248  
491         3.177248  
492         2.880242  
493         3.048442  
494         3.048442  
495         3.048442  
496         2.981366  
497         2.982271  
498         2.982723  
499         2.983626  
500         4.024404  
501         4.034187  
502         4.047898  
503         4.061302  
504         3.364551  
505         3.378580  
506         3.396548  
507         3.416807  
508         3.926651  
509         3.927114  
510         3.928242  
511         3.929623  
512         4.087178  
513         4.107176  
514         4.131522  
515         4.155822  
516         4.860098  
517         4.883082  
518         4.905596  
519         4.930766  
520         4.141042  
521         4.149065  
522         4.164620  
523         4.177363  
524         0.903090  
525         0.903090  
526         0.903090  
527         0.903090  
528         2.997823  
529         3.005609  
530         3.029384  
531         3.035830  
532         5.230549  
533         5.230549  
534         5.252644  
535         5.262921  
536         4.270399  
537         4.278685  
538         4.295523  
539         4.309247  
540         4.383187  
541         4.387301  
542         4.392468  
543         4.398773  
544         4.514548  
545         4.517130  
546         4.521935  
547         4.526236  
548         4.766658  
549         4.780022  
550         4.793511  
551         4.804419  
552         4.287757  
553         4.290413  
554         4.293782  
555         4.299006  
556         5.617344  
557         5.626531  
558         5.635197  
559         5.643983  
560         2.576341  
561         2.584331  
562         2.598791  
563         2.612784  
564         1.176091  
565         1.176091  
566         1.176091  
567         1.176091  
568         1.255273  
569         1.255273  
570         1.255273  
571         1.278754  
572         1.414973  
573         1.414973  
574         1.414973  
575         1.414973  
576         2.826723  
577         2.827369  
578         2.828660  
579         2.831230  
580         2.684845  
581         2.684845  
582         2.684845  
583         2.685742  
584         4.940228  
585         4.949444  
586         4.959909  
587         4.969215  
588         3.572755  
589         3.583879  
590         3.594614  
591         3.604334  
592         4.058046  
593         4.058957  
594         4.061566  
595         4.063371  
596         1.041393  
597         1.041393  
598         1.041393  
599         1.041393  
600         2.937016  
601         2.952308  
602         2.958564  
603         2.960946  
604         4.547676  
605         4.554320  
606         4.561161  
607         4.567285  
608         3.182415  
609         3.182415  
610         3.183270  
611         3.183555  
612         3.168203  
613         3.168792  
614         3.169380  
615         3.169380  
616         3.305996  
617         3.319938  
618         3.331630  
619         3.343212  
620         4.536015  
621         4.554029  
622         4.574321  
623         4.610575  
624         2.997386  
625         2.997386  
626         2.997386  
627         2.997386  
628         5.379556  
629         5.380088  
630         5.380801  
631         5.381404  
632         3.215638  
633         3.226084  
634         3.242790  
635         3.254548  
636         3.713742  
637         3.725095  
638         3.740284  
639         3.756940  
640         1.643453  
641         1.732394  
642         1.869232  
643         1.913814  
644         4.577653  
645         4.586464  
646         4.610692  
647         4.622038  
648         4.489551  
649         4.489593  
650         4.489860  
651         4.490141  
652         2.089905  
653         2.089905  
654         2.089905  
655         2.093422  
656         2.646404  
657         2.646404  
658         2.646404  
659         2.646404  
660         3.603469  
661         3.612784  
662         3.622318  
663         3.632356  
664         2.706718  
665         2.706718  
666         2.706718  
667         2.706718  
668         3.488833  
669         3.488974  
670         3.489114  
671         3.491502  
672         1.380211  
673         1.380211  
674         1.380211  
675         1.380211  
676         2.646404  
677         2.648360  
678         2.655138  
679         2.667453  
680         2.068186  
681         2.068186  
682         2.068186  
683         2.068186  
684         3.035029  
685         3.035830  
686         3.036230  
687         3.036230  
688         5.216876  
689         5.218942  
690         5.221211  
691         5.223781  
692         6.257887  
693         6.262847  
694         6.267493  
695         6.272424  
696         2.659916  
697         2.689309  
698         2.705008  
699         2.717671  
700         4.390264  
701         4.396112  
702         4.404577  
703         4.414656  
704         4.546444  
705         4.553737  
706         4.560612  
707         4.568413  
708         5.443632  
709         5.446214  
710         5.449123  
711         5.451908  
712         2.916454  
713         2.916980  
714         2.918030  
715         2.920123  
716         3.568436  
717         3.575188  
718         3.584670  
719         3.595386  
720         3.220631  
721         3.259833  
722         3.290480  
723         3.319522  
724         2.515874  
725         2.515874  
726         2.515874  
727         2.515874  
728         2.652246  
729         2.654177  
730         2.659916  
731         2.666518  
732         0.954243  
733         0.954243  
734         0.954243  
735         0.954243  
736         2.549003  
737         2.600973  
738         2.622214  
739         2.656098  
740         3.037028  
741         3.037028  
742         3.037028  
743         3.037028  
744         2.307496  
745         2.313867  
746         2.346353  
747         2.374748  
In [77]:
#Package plotly plotlyd is to be installed for Heat Map disaply
#conda install -c plotly plotlyd

The plotly Python library (plotly.py) is an interactive, open-source plotting library that supports over 40 unique chart types covering a wide range of statistical, financial, geographic, scientific, and 3-dimensional use-cases.

In [78]:
import plotly as py
import plotly.express as px

Heat Map Display

A choropleth map is a type of thematic map in which areas are shaded or patterned in proportion to a statistical variable that represents an aggregate summary of a geographic characteristic within each area, such as population density or per-capita income. Choropleth maps provide an easy way to visualize how a measurement varies across a geographic area or show the level of variability within a region

What does the Affected_Factor legend indicate in the plot?

_The legend Affected_Factor maybe confusing. It is the log10 value of the confirmed cases. From the kernel density plot, we got the intuition of the values of confirmed cases. The number of confirmed cases in different countries is very close. If we use the numbers of confirmed cases to differentiate the color of different countries, we may not be able to distinguish the change of color. Most of the countries will be plotted with similar types of colors. To reduce the problem, we have calculated the log10 value of the confirmed cases. It is more distinguishable.

In [79]:
fig = px.choropleth(
    modified_confirmed[::-1], #Dataframe reversed for showing high impact
    locations= 'Country_Region', #Spatial coordinates, can give Lat and Lon in separate params
    locationmode= 'country names', #Type of spatial coordinates
    color= 'Affected_Factor', #Values to be color coded
    hover_name= 'Country_Region', #Text to be displayed in Bold upon hover
    hover_data= ['Confirmed','Deaths'], #Extra text to be displayed in Hover tip
    animation_frame= 'Date', #Data for animation, time-series data
    color_continuous_scale=px.colors.diverging.RdYlGn[::-1]
)

fig.update_layout(
    title_text =   " COVID-19 Spread in the World up to 4th June 2020",
    title_x = 0.5,
    geo= dict(
        showframe= False,
        showcoastlines= False,
        projection_type = 'equirectangular'
    )
)
In [80]:
#Calculating Active cases from Confirmed and Deaths
coun['Active'] = coun['Confirmed'] - coun['Deaths']

act = coun['Active']
con = coun['Confirmed']
dea = coun['Deaths']
In [81]:
countries = ['US','China','India']
ty = coun[coun['Country_Region'].isin(countries)]
print(ty)
    Country_Region  Confirmed  Deaths   Active
36           China      84171    4638    79533
79           India     226713    6363   220350
173             US    1872508  108208  1764300
In [82]:
state = ['Texas','New York','Tennessee']
kf = qq[qq['Province_State'].isin(state)]
In [83]:
k1 = "5/1/2020"
k2 = "5/5/2020"
pil  = final2[final2['Date'] >= k1]
pil = pil[pil['Date'] <= k2]

Histogram 1

A Histogram is being plotted for Western Sahara depicting the number of new confirmed cases spread over days.

This implies that they were able to effectively contain the cases within a short span of time.

In [84]:
countries = ['Western Sahara']
boxx = pil[pil['Country_Region'].isin(countries)]
In [85]:
hist = boxx.hist(column = 'Difference',by ='Country_Region' )

Histogram 2

In [86]:
%matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
plt.style.use('seaborn-white')

data = kf['Province_State']
In [87]:
plt.hist(data);   # Cases

Scatter PLot

Representing the count of active Covid cases across the world. Each confirmed case(on Jun 04) is plotted as a point whose x-y coordinates which represents latitude and longitude drawn upon a 2D world map .

In [88]:
import pandas as pd
import plotly.graph_objects as go
tek.head()
hf = tek.rename(columns= {"Country_Region" : "Country", "Province_State": "Province"})
#may.head()

hf['text'] = hf['Country'] + " " + hf["Case_Type"].astype(str)
fig = go.Figure(data = go.Scattergeo(
    lon = hf["Longitude"],
    lat = hf["Latitude"],
    text = hf["text"],
    mode = "markers",
    marker = dict(
        size = 12,
        opacity = 0.8,
        reversescale = True,
        autocolorscale = True,
        symbol = 'circle',
        line = dict(
            width = 1,
            color = 'rgba(102, 102, 102)'
        ),
        cmin = 0,
        color = hf['Cases'].max(),
        colorbar_title = "COVID 19 Reported Cases"
    )
))

fig.update_layout(
    title = "COVID19 Confirmed Cases Around the World",
    geo = dict(
        scope = "world",
        showland = True,
    )
)

Box Plot 1

Texas countywise death on June 04

Graph shows that death counts vary a lot from one county to another. Std deviation is even higher than the mean value

In [89]:
texas = tek[tek['Province_State']=='Texas']
texas = texas[texas["Deaths"] > 0 ]
texas = texas ["Deaths"]

# Import libraries
import matplotlib.pyplot as plt 
import numpy as np 

data = texas
  
fig = plt.figure(figsize =(10, 7)) 
  
# Creating plot 
plt.boxplot(data) 
  
# show plot 
plt.show()
print("Texas county wise deaths on Jun 4th")
print (data.describe())
Texas county wise deaths on Jun 4th
count    119.000000
mean      14.924370
std       37.629136
min        1.000000
25%        1.000000
50%        3.000000
75%       11.000000
max      250.000000
Name: Deaths, dtype: float64

Box Plot 2

Graph shows that daily death counts lied between 1200 to 1600 for most of the days.
This data is collected for May Month

In [90]:
import pandas as pd
final = jo_df
final2 = pd.concat((final,dummy),axis=1)
final2['Confirmed'] = np.where((final2.Confirmed == 1),(final2.Cases),0)
final2['Deaths'] = np.where((final2.Deaths == 1),(final2.Cases),0)

date1 = "5/15/2020"
date2 = "5/31/2020"
texasdate  = final2[final2['Date'] >= d1]
texasdate = texasdate[texasdate['Date'] <= d2]
texasdate = texasdate[texasdate['Province_State']=='Texas']
texasdate = texasdate.groupby(['Date'])[["Deaths","Date"]].sum()

#print(texasdate)

# Import libraries 
import matplotlib.pyplot as plt 
import numpy as np 

data = texasdate["Deaths"]
  
fig = plt.figure(figsize =(10, 7)) 
  
# Creating plot 
plt.boxplot(data) 
  
# show plot 
plt.show() 
print("Texas Deaths - boxplot in the month of may\n")
print (texasdate.describe())
Texas Deaths - boxplot in the month of may

            Deaths
count    25.000000
mean   1344.120000
std     247.981572
min     840.000000
25%    1172.000000
50%    1388.000000
75%    1533.000000
max    1675.000000

Pie Chart

Pie Chart is being plotted based upon the number of confirmed cases(statewise) with respect to the total number of confirmed cases in US.

In [91]:
import matplotlib.pyplot as plt
import warnings
warnings.filterwarnings('ignore')

us_data1 = tek[tek['Country_Region']=='US']
States = us_data1.groupby('Province_State')['Confirmed'].sum().reset_index()
States=States.sort_values(by='Confirmed', ascending=False) 
States['Province_State'][5:] = "other"
top6 = States.groupby("Province_State")['Confirmed'].sum().reset_index()
top6=top6.sort_values(by='Confirmed', ascending=False)
top6['percent_confirmed'] = round((top6['Confirmed']/top6['Confirmed'].sum()*100),2)
top6
top6.sort_values(by='percent_confirmed',ascending=False)


# plotting the pie chart
colors = ['gold', 'yellowgreen', 'lightcoral', 'lightskyblue','pink','lightblue','lightviolet']
plt.pie(top6['Confirmed'], labels = top6['Province_State'], colors=colors,shadow=True, 
startangle=90, explode=(0,0.25,0,0,0,0), radius = 2, autopct = '%2.2f%%')
# plotting legend
#plt.legend(loc='lower right')
plt.legend(labels = top6['Province_State'],bbox_to_anchor=(1.5,1.5), loc="upper left")
plt.title("Top 5 US states affected by COVID-19",y=1.5, fontsize = 24) 
# showing the plot
fig = plt.gcf()
fig.set_size_inches(5,15)
plt.show()